[PATCH 0/2] usb: Fix giveback_urb_bh deadlock on URB dequeue
From: Chien Kun Niu
Date: Fri Nov 13 2026 - 02:36:02 EST
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
--
2.56.0.567.gdb80ae8cd5-goog