USB: metro-usb: fix io after disconnect
Make sure no control urb is submitted during close after a disconnect by checking the disconnected flag. Cc: <stable@vger.kernel.org> Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
		
					parent
					
						
							
								50dde8686e
							
						
					
				
			
			
				commit
				
					
						2ee44fbeac
					
				
			
		
					 1 changed files with 5 additions and 8 deletions
				
			
		| 
						 | 
					@ -179,16 +179,13 @@ static void metrousb_cleanup(struct usb_serial_port *port)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	dev_dbg(&port->dev, "%s\n", __func__);
 | 
						dev_dbg(&port->dev, "%s\n", __func__);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (port->serial->dev) {
 | 
						usb_unlink_urb(port->interrupt_in_urb);
 | 
				
			||||||
		/* Shutdown any interrupt in urbs. */
 | 
						usb_kill_urb(port->interrupt_in_urb);
 | 
				
			||||||
		if (port->interrupt_in_urb) {
 | 
					 | 
				
			||||||
			usb_unlink_urb(port->interrupt_in_urb);
 | 
					 | 
				
			||||||
			usb_kill_urb(port->interrupt_in_urb);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Send deactivate cmd to device */
 | 
						mutex_lock(&port->serial->disc_mutex);
 | 
				
			||||||
 | 
						if (!port->serial->disconnected)
 | 
				
			||||||
		metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port);
 | 
							metrousb_send_unidirectional_cmd(UNI_CMD_CLOSE, port);
 | 
				
			||||||
	}
 | 
						mutex_unlock(&port->serial->disc_mutex);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port)
 | 
					static int metrousb_open(struct tty_struct *tty, struct usb_serial_port *port)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue