Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: serial: sierra: fix potential deadlock at close

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: 014333f77c0b ("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>

authored by

John Ogness and committed by
Johan Hovold
e6087001 2ba02c8d

+2 -2
+2 -2
drivers/usb/serial/sierra.c
··· 770 770 kfree(urb->transfer_buffer); 771 771 usb_free_urb(urb); 772 772 usb_autopm_put_interface_async(serial->interface); 773 - spin_lock(&portdata->lock); 773 + spin_lock_irq(&portdata->lock); 774 774 portdata->outstanding_urbs--; 775 - spin_unlock(&portdata->lock); 775 + spin_unlock_irq(&portdata->lock); 776 776 } 777 777 778 778 sierra_stop_rx_urbs(port);