Skip to content

Commit

Permalink
USB: serial: sierra: fix potential deadlock at close
Browse files Browse the repository at this point in the history
The portdata spinlock can be taken in interrupt context (via
sierra_outdat_callback()).
Disable interrupts when taking the portdata spinlock when discarding
deferred URBs during close to prevent a possible deadlock.

Fixes: 014333f ("USB: sierra: fix urb and memory leak on disconnect")
Cc: stable <stable@vger.kernel.org>
Signed-off-by: John Ogness <john.ogness@linutronix.de>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
[ johan: amend commit message and add fixes and stable tags ]
Signed-off-by: Johan Hovold <johan@kernel.org>
  • Loading branch information
jogness authored and jhovold committed Jun 26, 2018
1 parent 2ba02c8 commit e608700
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/usb/serial/sierra.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,9 +770,9 @@ static void sierra_close(struct usb_serial_port *port)
kfree(urb->transfer_buffer);
usb_free_urb(urb);
usb_autopm_put_interface_async(serial->interface);
spin_lock(&portdata->lock);
spin_lock_irq(&portdata->lock);
portdata->outstanding_urbs--;
spin_unlock(&portdata->lock);
spin_unlock_irq(&portdata->lock);
}

sierra_stop_rx_urbs(port);
Expand Down

0 comments on commit e608700

Please sign in to comment.