mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] usb: Fix giveback_urb_bh deadlock on URB dequeue
@ 2026-11-13  4:02 Chien Kun Niu
  2026-11-13  4:02 ` [PATCH 1/2] usb: core: hcd: Disable IRQs when taking bh->lock Chien Kun Niu
  2026-11-13  4:02 ` [PATCH 2/2] xhci: Give back URB under lock in xhci_urb_dequeue() Chien Kun Niu
  0 siblings, 2 replies; 3+ messages in thread
From: Chien Kun Niu @ 2026-11-13  4:02 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Mathias Nyman
  Cc: Alan Stern, linux-usb, linux-kernel, Chien Kun Niu

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-13  4:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-13  4:02 [PATCH 0/2] usb: Fix giveback_urb_bh deadlock on URB dequeue Chien Kun Niu
2026-11-13  4:02 ` [PATCH 1/2] usb: core: hcd: Disable IRQs when taking bh->lock Chien Kun Niu
2026-11-13  4:02 ` [PATCH 2/2] xhci: Give back URB under lock in xhci_urb_dequeue() Chien Kun Niu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®