mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	usb-serial: possible irq lock inversion (PPP vs. usb/serial)
========================================================= [ INFO: possible irq lock inversion dependency detected ]
This commit is contained in:
		
							parent
							
								
									2e3a43f0b6
								
							
						
					
					
						commit
						e81ee637e4
					
				
					 7 changed files with 21 additions and 21 deletions
				
			
		| 
						 | 
					@ -214,14 +214,14 @@ static int cyberjack_write (struct usb_serial_port *port, const unsigned char *b
 | 
				
			||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&port->lock);
 | 
						spin_lock_bh(&port->lock);
 | 
				
			||||||
	if (port->write_urb_busy) {
 | 
						if (port->write_urb_busy) {
 | 
				
			||||||
		spin_unlock(&port->lock);
 | 
							spin_unlock_bh(&port->lock);
 | 
				
			||||||
		dbg("%s - already writing", __FUNCTION__);
 | 
							dbg("%s - already writing", __FUNCTION__);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	port->write_urb_busy = 1;
 | 
						port->write_urb_busy = 1;
 | 
				
			||||||
	spin_unlock(&port->lock);
 | 
						spin_unlock_bh(&port->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock_irqsave(&priv->lock, flags);
 | 
						spin_lock_irqsave(&priv->lock, flags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -175,14 +175,14 @@ int usb_serial_generic_write(struct usb_serial_port *port, const unsigned char *
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* only do something if we have a bulk out endpoint */
 | 
						/* only do something if we have a bulk out endpoint */
 | 
				
			||||||
	if (serial->num_bulk_out) {
 | 
						if (serial->num_bulk_out) {
 | 
				
			||||||
		spin_lock(&port->lock);
 | 
							spin_lock_bh(&port->lock);
 | 
				
			||||||
		if (port->write_urb_busy) {
 | 
							if (port->write_urb_busy) {
 | 
				
			||||||
			spin_unlock(&port->lock);
 | 
								spin_unlock_bh(&port->lock);
 | 
				
			||||||
			dbg("%s - already writing", __FUNCTION__);
 | 
								dbg("%s - already writing", __FUNCTION__);
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		port->write_urb_busy = 1;
 | 
							port->write_urb_busy = 1;
 | 
				
			||||||
		spin_unlock(&port->lock);
 | 
							spin_unlock_bh(&port->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
 | 
							count = (count > port->bulk_out_size) ? port->bulk_out_size : count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -394,14 +394,14 @@ static int ipw_write(struct usb_serial_port *port, const unsigned char *buf, int
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&port->lock);
 | 
						spin_lock_bh(&port->lock);
 | 
				
			||||||
	if (port->write_urb_busy) {
 | 
						if (port->write_urb_busy) {
 | 
				
			||||||
		spin_unlock(&port->lock);
 | 
							spin_unlock_bh(&port->lock);
 | 
				
			||||||
		dbg("%s - already writing", __FUNCTION__);
 | 
							dbg("%s - already writing", __FUNCTION__);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	port->write_urb_busy = 1;
 | 
						port->write_urb_busy = 1;
 | 
				
			||||||
	spin_unlock(&port->lock);
 | 
						spin_unlock_bh(&port->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	count = min(count, port->bulk_out_size);
 | 
						count = min(count, port->bulk_out_size);
 | 
				
			||||||
	memcpy(port->bulk_out_buffer, buf, count);
 | 
						memcpy(port->bulk_out_buffer, buf, count);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -342,14 +342,14 @@ static int ir_write (struct usb_serial_port *port, const unsigned char *buf, int
 | 
				
			||||||
	if (count == 0)
 | 
						if (count == 0)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&port->lock);
 | 
						spin_lock_bh(&port->lock);
 | 
				
			||||||
	if (port->write_urb_busy) {
 | 
						if (port->write_urb_busy) {
 | 
				
			||||||
		spin_unlock(&port->lock);
 | 
							spin_unlock_bh(&port->lock);
 | 
				
			||||||
		dbg("%s - already writing", __FUNCTION__);
 | 
							dbg("%s - already writing", __FUNCTION__);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	port->write_urb_busy = 1;
 | 
						port->write_urb_busy = 1;
 | 
				
			||||||
	spin_unlock(&port->lock);
 | 
						spin_unlock_bh(&port->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	transfer_buffer = port->write_urb->transfer_buffer;
 | 
						transfer_buffer = port->write_urb->transfer_buffer;
 | 
				
			||||||
	transfer_size = min(count, port->bulk_out_size - 1);
 | 
						transfer_size = min(count, port->bulk_out_size - 1);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -518,13 +518,13 @@ static int keyspan_pda_write(struct usb_serial_port *port,
 | 
				
			||||||
	   the TX urb is in-flight (wait until it completes)
 | 
						   the TX urb is in-flight (wait until it completes)
 | 
				
			||||||
	   the device is full (wait until it says there is room)
 | 
						   the device is full (wait until it says there is room)
 | 
				
			||||||
	*/
 | 
						*/
 | 
				
			||||||
	spin_lock(&port->lock);
 | 
						spin_lock_bh(&port->lock);
 | 
				
			||||||
	if (port->write_urb_busy || priv->tx_throttled) {
 | 
						if (port->write_urb_busy || priv->tx_throttled) {
 | 
				
			||||||
		spin_unlock(&port->lock);
 | 
							spin_unlock_bh(&port->lock);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	port->write_urb_busy = 1;
 | 
						port->write_urb_busy = 1;
 | 
				
			||||||
	spin_unlock(&port->lock);
 | 
						spin_unlock_bh(&port->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* At this point the URB is in our control, nobody else can submit it
 | 
						/* At this point the URB is in our control, nobody else can submit it
 | 
				
			||||||
	   again (the only sudden transition was the one from EINPROGRESS to
 | 
						   again (the only sudden transition was the one from EINPROGRESS to
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -256,14 +256,14 @@ static int omninet_write (struct usb_serial_port *port, const unsigned char *buf
 | 
				
			||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spin_lock(&wport->lock);
 | 
						spin_lock_bh(&wport->lock);
 | 
				
			||||||
	if (wport->write_urb_busy) {
 | 
						if (wport->write_urb_busy) {
 | 
				
			||||||
		spin_unlock(&wport->lock);
 | 
							spin_unlock_bh(&wport->lock);
 | 
				
			||||||
		dbg("%s - already writing", __FUNCTION__);
 | 
							dbg("%s - already writing", __FUNCTION__);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	wport->write_urb_busy = 1;
 | 
						wport->write_urb_busy = 1;
 | 
				
			||||||
	spin_unlock(&wport->lock);
 | 
						spin_unlock_bh(&wport->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;
 | 
						count = (count > OMNINET_BULKOUTSIZE) ? OMNINET_BULKOUTSIZE : count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -298,14 +298,14 @@ static int safe_write (struct usb_serial_port *port, const unsigned char *buf, i
 | 
				
			||||||
		dbg ("%s - write request of 0 bytes", __FUNCTION__);
 | 
							dbg ("%s - write request of 0 bytes", __FUNCTION__);
 | 
				
			||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	spin_lock(&port->lock);
 | 
						spin_lock_bh(&port->lock);
 | 
				
			||||||
	if (port->write_urb_busy) {
 | 
						if (port->write_urb_busy) {
 | 
				
			||||||
		spin_unlock(&port->lock);
 | 
							spin_unlock_bh(&port->lock);
 | 
				
			||||||
		dbg("%s - already writing", __FUNCTION__);
 | 
							dbg("%s - already writing", __FUNCTION__);
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	port->write_urb_busy = 1;
 | 
						port->write_urb_busy = 1;
 | 
				
			||||||
	spin_unlock(&port->lock);
 | 
						spin_unlock_bh(&port->lock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	packet_length = port->bulk_out_size;	// get max packetsize
 | 
						packet_length = port->bulk_out_size;	// get max packetsize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue