Linux USB
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joshua Crofts" <crofts@kernel.org>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH 2/3] usb: musb: remove redundant pm_runtime_dont_use_autosuspend() calls
Date: Fri, 06 Nov 2026 14:12:49 +0000	[thread overview]
Message-ID: <sashiko-outbox-201549@kernel.org> (raw)
In-Reply-To: <20261106133933.1577-3-crofts@kernel.org>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] usb: musb: use-after-free in musb_remove() [1]
--

commit 288b4875a2dac2d67d03e8708cdad214c6870682
Author: Joshua Crofts <crofts@kernel.org>

usb: musb: remove redundant pm_runtime_dont_use_autosuspend() calls

This commit removes redundant pm_runtime_dont_use_autosuspend() calls in
musb_init_controller() and musb_remove() since the driver core now handles
this on driver exit.

> diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
> index 73ac25f53698f..28e59b53fd02f 100644
> --- a/drivers/usb/musb/musb_core.c
> +++ b/drivers/usb/musb/musb_core.c

[ ... ]

> @@ -2644,7 +2643,6 @@ static void musb_remove(struct platform_device *pdev)
>  	spin_unlock_irqrestore(&musb->lock, flags);
>  	musb_platform_exit(musb);
>  
> -	pm_runtime_dont_use_autosuspend(musb->controller);
>  	pm_runtime_put_sync(musb->controller);
>  	pm_runtime_disable(musb->controller);
>  	musb_phy_callback = NULL;

[Severity: Critical]
This problem wasn't introduced by this patch, but can calling
musb_platform_exit(musb) before usb_phy_shutdown(musb->xceiv) a few lines
below cause a use-after-free on musb->xceiv [1]?

Platform exit callbacks such as da8xx_musb_exit() call
usb_put_phy(musb->xceiv), which drops the final reference and frees the PHY
before musb_remove() passes musb->xceiv to usb_phy_shutdown():

drivers/usb/musb/musb_core.c:musb_remove() {
	...
	musb_platform_exit(musb);

	pm_runtime_put_sync(musb->controller);
	pm_runtime_disable(musb->controller);
	musb_phy_callback = NULL;
	if (musb->dma_controller)
		musb_dma_controller_destroy(musb->dma_controller);
	usb_phy_shutdown(musb->xceiv);
	...
}

[1] https://sashiko.dev/#/bug/linux-d180c2b9-0006-4638-a22b-13df8c201235

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261106133933.1577-1-crofts@kernel.org?part=2

  reply	other threads:[~2026-11-06 14:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 13:39 [PATCH 0/3] usb: remove redundant pm_runtime_dont_use_autosuspend calls() Joshua Crofts
2026-11-06 13:39 ` [PATCH 1/3] usb: chipidea: remove redundant pm_runtime_dont_use_autosuspend() call Joshua Crofts
2026-11-06 13:45   ` sashiko-bot
2026-11-06 13:39 ` [PATCH 2/3] usb: musb: remove redundant pm_runtime_dont_use_autosuspend() calls Joshua Crofts
2026-11-06 14:12   ` sashiko-bot [this message]
2026-11-06 13:39 ` [PATCH 3/3] usb: dwc3: " Joshua Crofts
2026-11-06 14:25   ` sashiko-bot

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=sashiko-outbox-201549@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=crofts@kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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