Skip to content

Commit

Permalink
USB: quatech2: fix close and disconnect urb handling
Browse files Browse the repository at this point in the history
Kill urbs unconditionally at close and disconnect.

Note that URB status is not valid outside of completion handler.

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 40d0473 commit 8e512ab
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions drivers/usb/serial/quatech2.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ static void qt2_close(struct usb_serial_port *port)
port_priv->is_open = false;

spin_lock_irqsave(&port_priv->urb_lock, flags);
if (port_priv->write_urb->status == -EINPROGRESS)
usb_kill_urb(port_priv->write_urb);
usb_kill_urb(port_priv->write_urb);
port_priv->urb_in_use = false;
spin_unlock_irqrestore(&port_priv->urb_lock, flags);

Expand Down Expand Up @@ -465,8 +464,7 @@ static void qt2_disconnect(struct usb_serial *serial)
{
struct qt2_serial_private *serial_priv = usb_get_serial_data(serial);

if (serial_priv->read_urb->status == -EINPROGRESS)
usb_kill_urb(serial_priv->read_urb);
usb_kill_urb(serial_priv->read_urb);
}

static int get_serial_info(struct usb_serial_port *port,
Expand Down

0 comments on commit 8e512ab

Please sign in to comment.