The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Guangshuo Li <lgs201920130244@gmail.com>
Cc: Kees Cook <kees@kernel.org>, Duoming Zhou <duoming@zju.edu.cn>,
	Li Yang <leoyang.li@nxp.com>, Anatolij Gustschin <agust@denx.de>,
	linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: phy: fsl-usb: clear fsl_otg_dev after freeing it
Date: Fri, 10 Jul 2026 15:17:12 +0200	[thread overview]
Message-ID: <2026071054-cranial-manor-b4b6@gregkh> (raw)
In-Reply-To: <20260708064549.719147-1-lgs201920130244@gmail.com>

On Wed, Jul 08, 2026 at 02:45:49PM +0800, Guangshuo Li wrote:
> fsl_otg_dev is a file-scoped singleton pointer and is used by
> fsl_otg_conf() to decide whether the OTG device has already been
> initialized.
> 
> fsl_otg_remove() frees fsl_otg_dev but leaves the global pointer
> unchanged. A later bind can therefore see a non-NULL dangling pointer,
> skip initialization, and continue using freed memory through the global
> fsl_otg_dev pointer.
> 
> Clear fsl_otg_dev after freeing it so that a later probe does not treat a
> dangling pointer as an initialized device.
> 
> Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver")
> Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
> ---
>  drivers/usb/phy/phy-fsl-usb.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
> index 35d79f11b03d..0b5e937633f4 100644
> --- a/drivers/usb/phy/phy-fsl-usb.c
> +++ b/drivers/usb/phy/phy-fsl-usb.c
> @@ -997,6 +997,7 @@ static void fsl_otg_remove(struct platform_device *pdev)
>  	fsl_otg_uninit_timers();
>  	kfree(fsl_otg_dev->phy.otg);
>  	kfree(fsl_otg_dev);
> +	fsl_otg_dev = NULL;
>  
>  	if (pdata->exit)
>  		pdata->exit(pdev);
> -- 
> 2.43.0
> 
> 

For all of these patches, you have to document that you use an LLM.
Please resend them all with that information.

thanks,
greg k-h

      reply	other threads:[~2026-07-10 13:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08  6:45 [PATCH] usb: phy: fsl-usb: clear fsl_otg_dev after freeing it Guangshuo Li
2026-07-10 13:17 ` Greg Kroah-Hartman [this message]

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=2026071054-cranial-manor-b4b6@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=agust@denx.de \
    --cc=duoming@zju.edu.cn \
    --cc=kees@kernel.org \
    --cc=leoyang.li@nxp.com \
    --cc=lgs201920130244@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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