Linux USB
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: pxa25x: mark the watchdog timer IRQ-safe
@ 2026-10-09  3:13 Runyu Xiao
  2026-10-09  3:26 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Runyu Xiao @ 2026-10-09  3:13 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik
  Cc: Greg Kroah-Hartman, linux-arm-kernel, linux-usb, linux-kernel,
	stable, Runyu Xiao, Jianhao Xu

The PXA25x UDC reset path runs from its hard-IRQ handler and calls
timer_delete_sync() for the watchdog. The timer is currently initialized
without TIMER_IRQSAFE, so timer_delete_sync() warns and can deadlock when
the reset races with the watchdog callback.

Mark the timer IRQ-safe. Since IRQ-safe callbacks run with interrupts
disabled and remain so on return, remove the callback's local IRQ disable
and enable pair; local_irq_enable() would otherwise re-enable interrupts
before the callback returns.

Fixes: 8fa7292fee5c ("treewide: Switch/rename to timer_delete[_sync]()")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index 594d67193..41076ecca 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -1563,7 +1563,6 @@ static void udc_watchdog(struct timer_list *t)
 {
 	struct pxa25x_udc	*dev = timer_container_of(dev, t, timer);
 
-	local_irq_disable();
 	if (dev->ep0state == EP0_STALL
 			&& (udc_ep0_get_UDCCS(dev) & UDCCS0_FST) == 0
 			&& (udc_ep0_get_UDCCS(dev) & UDCCS0_SST) == 0) {
@@ -1571,7 +1570,6 @@ static void udc_watchdog(struct timer_list *t)
 		DBG(DBG_VERBOSE, "ep0 re-stall\n");
 		start_watchdog(dev);
 	}
-	local_irq_enable();
 }
 
 static void handle_ep0 (struct pxa25x_udc *dev)
@@ -2343,7 +2341,7 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
 		goto err;
 	}
 
-	timer_setup(&dev->timer, udc_watchdog, 0);
+	timer_setup(&dev->timer, udc_watchdog, TIMER_IRQSAFE);
 
 	the_controller = dev;
 	platform_set_drvdata(pdev, dev);
-- 
2.34.1

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

* Re: [PATCH] usb: gadget: pxa25x: mark the watchdog timer IRQ-safe
  2026-10-09  3:13 [PATCH] usb: gadget: pxa25x: mark the watchdog timer IRQ-safe Runyu Xiao
@ 2026-10-09  3:26 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-09  3:26 UTC (permalink / raw)
  To: Runyu Xiao; +Cc: linux-usb

> The PXA25x UDC reset path runs from its hard-IRQ handler and calls
> timer_delete_sync() for the watchdog. The timer is currently initialized
> without TIMER_IRQSAFE, so timer_delete_sync() warns and can deadlock when
> the reset races with the watchdog callback.
> 
> Mark the timer IRQ-safe. Since IRQ-safe callbacks run with interrupts
> disabled and remain so on return, remove the callback's local IRQ disable
> and enable pair; local_irq_enable() would otherwise re-enable interrupts
> before the callback returns.
> 
> Fixes: 8fa7292fee5c ("treewide: Switch/rename to timer_delete[_sync]()")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Runyu Xiao <runyu.xiao@seu.edu.cn>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261009031318.1122589-1-runyu.xiao@seu.edu.cn?part=1


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

end of thread, other threads:[~2026-10-09  3:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  3:13 [PATCH] usb: gadget: pxa25x: mark the watchdog timer IRQ-safe Runyu Xiao
2026-10-09  3:26 ` sashiko-bot

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