aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2012-10-25 10:29:10 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-10-31 10:10:16 -0700
commit38e602db5db176e642d66ab7bffabec143edc2f3 (patch)
treec9333c1d9df05afacbc49db9da9c4aa8754b81c6
parentf5c21b3815667aeae65a3ec56576294c5ed751e6 (diff)
downloadlinux-linaro-stable-38e602db5db176e642d66ab7bffabec143edc2f3.tar.gz
USB: quatech2: fix io after disconnect
commit 2f0295adf6438188c4cd0868f2b1976a2b034e1d upstream. Make sure no control urb is submitted during close after a disconnect by checking the disconnected flag. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/quatech2.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/usb/serial/quatech2.c b/drivers/usb/serial/quatech2.c
index e2c5b69c7eef..ea69301d89a2 100644
--- a/drivers/usb/serial/quatech2.c
+++ b/drivers/usb/serial/quatech2.c
@@ -429,6 +429,12 @@ static void qt2_close(struct usb_serial_port *port)
port_priv->urb_in_use = false;
spin_unlock_irqrestore(&port_priv->urb_lock, flags);
+ mutex_lock(&port->serial->disc_mutex);
+ if (port->serial->disconnected) {
+ mutex_unlock(&port->serial->disc_mutex);
+ return;
+ }
+
/* flush the port transmit buffer */
i = usb_control_msg(serial->dev,
usb_rcvctrlpipe(serial->dev, 0),
@@ -460,6 +466,7 @@ static void qt2_close(struct usb_serial_port *port)
dev_err(&port->dev, "%s - close port failed %i\n",
__func__, i);
+ mutex_unlock(&port->serial->disc_mutex);
}
static void qt2_disconnect(struct usb_serial *serial)