From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Hongyan Xu <getshell@seu.edu.cn>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
Claudiu Beznea <claudiu.beznea@tuxon.dev>,
linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
jianhao.xu@seu.edu.cn
Subject: Re: [PATCH] usb: host: ehci-atmel: stop clocks before releasing HCD
Date: Thu, 6 Aug 2026 08:16:16 +0200 [thread overview]
Message-ID: <2026080610-easter-unwieldy-57ea@gregkh> (raw)
In-Reply-To: <20260806060557.1747-1-getshell@seu.edu.cn>
On Thu, Aug 06, 2026 at 02:05:57PM +0800, Hongyan Xu wrote:
> usb_put_hcd() drops the driver's HCD reference and can free the HCD and its
> private data. The remove callback then calls atmel_stop_ehci(), which
> obtains that HCD from platform data and dereferences its private data to
> disable the clocks.
>
> Stop the controller clocks before dropping the HCD reference so that
> atmel_stop_ehci() cannot access an already freed HCD.
>
> Fixes: 501c9c0802d9 ("USB: at91: Add USB EHCI driver for at91sam9g45 series")
> Signed-off-by: Hongyan Xu <getshell@seu.edu.cn>
> ---
> 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 65747270fd88..bcd56f888ec9 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
>
>
How was this tested?
next prev parent reply other threads:[~2026-08-06 6:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 6:05 [PATCH] usb: host: ehci-atmel: stop clocks before releasing HCD Hongyan Xu
2026-08-06 6:16 ` Greg Kroah-Hartman
2026-08-06 6:16 ` Greg Kroah-Hartman [this message]
2026-08-06 13:50 ` Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026080610-easter-unwieldy-57ea@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=alexandre.belloni@bootlin.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=getshell@seu.edu.cn \
--cc=jianhao.xu@seu.edu.cn \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox