Skip to content

Commit

Permalink
USB: metro-usb: fix io after disconnect
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johan Hovold authored and Greg Kroah-Hartman committed Oct 25, 2012
1 parent 50dde86 commit 2ee44fb
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions drivers/usb/serial/metro-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,13 @@ static void metrousb_cleanup(struct usb_serial_port *port)
{
dev_dbg(&port->dev, "%s\n", __func__);

if (port->serial->dev) {
/* Shutdown any interrupt in urbs. */
if (port->interrupt_in_urb) {
usb_unlink_urb(port->interrupt_in_urb);
usb_kill_urb(port->interrupt_in_urb);
}

/* Send deactivate cmd to device */
usb_unlink_urb(port->interrupt_in_urb);
usb_kill_urb(port->interrupt_in_urb);

mutex_lock(&port->serial->disc_mutex);
if (!port->serial->disconnected)
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)
Expand Down

0 comments on commit 2ee44fb

Please sign in to comment.