* [PATCH v2] usb: host: ehci-atmel: stop clocks before releasing HCD
@ 2026-11-15 11:48 Hongyan Xu
2026-11-15 11:58 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Hongyan Xu @ 2026-11-15 11:48 UTC (permalink / raw)
To: Greg Kroah-Hartman, Alan Stern
Cc: Nicolas Ferre, Alexandre Belloni, Claudiu Beznea, linux-usb,
linux-arm-kernel, linux-kernel, stable
usb_put_hcd() can release the HCD and its private data. Calling
atmel_stop_ehci() afterwards retrieves that HCD from platform data
and accesses its private clock state.
Stop the controller clocks after usb_remove_hcd() has quiesced the
host, but before dropping the driver's HCD reference. This matches
the probe error unwind, which already stops the clocks before
usb_put_hcd().
Found by the author's in-house static analysis tool.
Fixes: 501c9c0802d9 ("USB: at91: Add USB EHCI driver for at91sam9g45 series")
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/all/20260806060557.1747-1-getshell@seu.edu.cn/
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
Signed-off-by: Zehao Gao <gaozehao@iie.ac.cn>
---
Discovery: found by the author's in-house static analysis tool.
drivers/usb/host/ehci-atmel.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 6574727..bcd56f8 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -177,9 +177,8 @@ static void ehci_atmel_drv_remove(struct platform_device *pdev)
struct usb_hcd *hcd = platform_get_drvdata(pdev);
usb_remove_hcd(hcd);
- usb_put_hcd(hcd);
-
atmel_stop_ehci(pdev);
+ usb_put_hcd(hcd);
}
static int __maybe_unused ehci_atmel_drv_suspend(struct device *dev)
--
2.50.1.windows.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] usb: host: ehci-atmel: stop clocks before releasing HCD
2026-11-15 11:48 [PATCH v2] usb: host: ehci-atmel: stop clocks before releasing HCD Hongyan Xu
@ 2026-11-15 11:58 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-15 11:58 UTC (permalink / raw)
To: Hongyan Xu; +Cc: linux-usb
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] usb: ehci-atmel: Fixes tag cites 501c9c0802d9 instead of
7baddacbe1bc
--
commit 01c8113ae4f3e9e4bce884feb37af84c2ce05255
Author: Hongyan Xu <getshell@seu.edu.cn>
> usb: host: ehci-atmel: stop clocks before releasing HCD
>
> usb_put_hcd() can release the HCD and its private data. Calling
> atmel_stop_ehci() afterwards retrieves that HCD from platform data
> and accesses its private clock state.
>
> Stop the controller clocks after usb_remove_hcd() has quiesced the
> host, but before dropping the driver's HCD reference. This matches
> the probe error unwind, which already stops the clocks before
> usb_put_hcd().
>
> Found by the author's in-house static analysis tool.
>
> Fixes: 501c9c0802d9 ("USB: at91: Add USB EHCI driver for at91sam9g45 series")
> Cc: stable@vger.kernel.org
> Link: https://lore.kernel.org/all/20260806060557.1747-1-getshell@seu.edu.cn/
> Acked-by: Alan Stern <stern@rowland.harvard.edu>
> Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
> Signed-off-by: Zehao Gao <gaozehao@iie.ac.cn>
[Severity: Low]
In 501c9c0802d9 ("USB: at91: Add USB EHCI driver for at91sam9g45 series"),
the clock state was stored in file-scope static variables and
atmel_stop_ehci() did not access hcd or its private data. The clocks were
moved into struct atmel_ehci_priv inside hcd->hcd_priv and dereferenced in
atmel_stop_ehci() by 7baddacbe1bc ("USB: host: ehci-atmel: Move global
variables to private struct").
Should the Fixes tag be:
Fixes: 7baddacbe1bc ("USB: host: ehci-atmel: Move global variables to private struct")
--
Sashiko AI review · https://sashiko.dev/#/patchset/179474328429.103840.11561415733183356947@seu.edu.cn?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-15 11:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 11:48 [PATCH v2] usb: host: ehci-atmel: stop clocks before releasing HCD Hongyan Xu
2026-11-15 11:58 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.