diff options
author | Johan Hovold <jhovold@gmail.com> | 2012-10-25 04:29:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-10-25 12:36:58 -0400 |
commit | 2f0295adf6438188c4cd0868f2b1976a2b034e1d (patch) | |
tree | d9e1ee413e1bbaaf4b2e5e44d9b3fd79de3a4b86 | |
parent | 8e512ab0b675da20e023439a5811e3f2554e6852 (diff) |
USB: quatech2: 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>
-rw-r--r-- | drivers/usb/serial/quatech2.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c index 7e8d8f32b634..ffcfc962ab10 100644 --- a/drivers/usb/serial/quatech2.c +++ b/drivers/usb/serial/quatech2.c | |||
@@ -427,6 +427,12 @@ static void qt2_close(struct usb_serial_port *port) | |||
427 | port_priv->urb_in_use = false; | 427 | port_priv->urb_in_use = false; |
428 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); | 428 | spin_unlock_irqrestore(&port_priv->urb_lock, flags); |
429 | 429 | ||
430 | mutex_lock(&port->serial->disc_mutex); | ||
431 | if (port->serial->disconnected) { | ||
432 | mutex_unlock(&port->serial->disc_mutex); | ||
433 | return; | ||
434 | } | ||
435 | |||
430 | /* flush the port transmit buffer */ | 436 | /* flush the port transmit buffer */ |
431 | i = usb_control_msg(serial->dev, | 437 | i = usb_control_msg(serial->dev, |
432 | usb_rcvctrlpipe(serial->dev, 0), | 438 | usb_rcvctrlpipe(serial->dev, 0), |
@@ -458,6 +464,7 @@ static void qt2_close(struct usb_serial_port *port) | |||
458 | dev_err(&port->dev, "%s - close port failed %i\n", | 464 | dev_err(&port->dev, "%s - close port failed %i\n", |
459 | __func__, i); | 465 | __func__, i); |
460 | 466 | ||
467 | mutex_unlock(&port->serial->disc_mutex); | ||
461 | } | 468 | } |
462 | 469 | ||
463 | static void qt2_disconnect(struct usb_serial *serial) | 470 | static void qt2_disconnect(struct usb_serial *serial) |