[PATCH v3 2/6] usb: dwc2: fix a possible interrupt storm in hcd resume

From: Fabrice Gasnier

Date: Fri Nov 06 2026 - 12:44:11 EST


The host interrupts are re-enabled in dwc2_hcd_reinit(). So there is a
race during resume between a possible hcd IRQ, and the HW accessible bit
to be set. This can result in a bad_irq to be reported (nobody cared).
So set the HW accessible bit before calling dwc2_hcd_reinit().

Fixes: ef5e0eec4764 ("usb: dwc2: Add clock gating exiting flow by system resume")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@xxxxxxxxxxx>
---
Note it's been found while debugging with additional mdelay after
dwc2_hcd_reinit() call.
---
Changes in v2:
- Introduce this patch since debug session (since sashiko comment on
patch 1)
---
drivers/usb/dwc2/hcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index d5275cd658d4..28cde15e0cca 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -4469,14 +4469,14 @@ static int _dwc2_hcd_resume(struct usb_hcd *hcd)
*/
dwc2_core_init(hsotg, false);
dwc2_enable_global_interrupts(hsotg);
- dwc2_hcd_reinit(hsotg);
- spin_lock_irqsave(&hsotg->lock, flags);

/*
* Set HW accessible bit before powering on the controller
* since an interrupt may rise.
*/
set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
+ dwc2_hcd_reinit(hsotg);
+ spin_lock_irqsave(&hsotg->lock, flags);
break;
default:
hsotg->lx_state = DWC2_L0;

--
2.43.0