usb: Fix giveback_urb_bh deadlock on URB dequeue
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 1 replyIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | usb: core: hcd: Disable IRQs when taking bh->lockdrivers/ | +3 | 0 replies | |
| 2/2 | xhci: Give back URB under lock in xhci_urb_dequeue()drivers/ | +1 | 1 reply |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] usb: Fix giveback_urb_bh deadlock on URB dequeue
We hit a CPU hardlockup during reboot while usbnet was unlinking queued RX URBs on a halted xHCI controller.
In xhci_urb_dequeue(), the err_giveback path releases xhci->lock and restores interrupts before calling usb_hcd_giveback_urb(). Because usb_hcd_giveback_urb() takes bh->lock with plain spin_lock(), an interrupt arriving on the same CPU can deadlock on bh->lock either in usb_hcd_irq() or when softirq runs usb_giveback_urb_bh().
Patch 1 switches usb_hcd_giveback_urb() to spin_lock_irqsave() since bh->lock is also acquired in hardirq and BH contexts.
Patch 2 keeps xhci->lock held across usb_hcd_giveback_urb() in xhci_urb_dequeue(), matching xhci_giveback_urb_in_irq() and keeping per-endpoint URB giveback ordering serialized.
The two patches are independent and can be applied in either order.
Chien Kun Niu (2):
usb: core: hcd: Disable IRQs when taking bh->lock
xhci: Give back URB under lock in xhci_urb_dequeue()
drivers/usb/core/hcd.c | 5 +++-- drivers/usb/host/xhci.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
base-commit: b3dfbde62cf1981c4638939c159dfd087b7a72e9
Signature · 1 line
2.56.0.567.gdb80ae8cd5-goog