Commit 2f0295ad authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

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: default avatarJohan Hovold <jhovold@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8e512ab0
...@@ -427,6 +427,12 @@ static void qt2_close(struct usb_serial_port *port) ...@@ -427,6 +427,12 @@ static void qt2_close(struct usb_serial_port *port)
port_priv->urb_in_use = false; port_priv->urb_in_use = false;
spin_unlock_irqrestore(&port_priv->urb_lock, flags); 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 */ /* flush the port transmit buffer */
i = usb_control_msg(serial->dev, i = usb_control_msg(serial->dev,
usb_rcvctrlpipe(serial->dev, 0), usb_rcvctrlpipe(serial->dev, 0),
...@@ -458,6 +464,7 @@ static void qt2_close(struct usb_serial_port *port) ...@@ -458,6 +464,7 @@ static void qt2_close(struct usb_serial_port *port)
dev_err(&port->dev, "%s - close port failed %i\n", dev_err(&port->dev, "%s - close port failed %i\n",
__func__, i); __func__, i);
mutex_unlock(&port->serial->disc_mutex);
} }
static void qt2_disconnect(struct usb_serial *serial) static void qt2_disconnect(struct usb_serial *serial)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment