mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: b-liu@ti.com
Cc: balbi@ti.com, fabio.baltieri@linaro.org,
	gregkh@linuxfoundation.org, linusw@kernel.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] usb: musb: ux500: Fix transceiver leak in ux500_musb_init()
Date: Wed, 16 Sep 2026 16:50:55 +0000	[thread overview]
Message-ID: <20260916165055.2085246-1-vulab@iscas.ac.cn> (raw)

ux500_musb_init() takes a reference on the USB2 transceiver with
usb_get_phy() and stores it in musb->xceiv. If the subsequent
usb_register_notifier() call fails, the function returns without
releasing the reference, leaking the transceiver. The only place the
reference is put is ux500_musb_exit(), which is not run when the init
fails.

Put the transceiver before returning on the notifier registration
failure path. The notifier itself does not need to be unregistered
since usb_register_notifier() failed.

Fixes: 0135522c4898 ("usb: musb: ux500: add otg notifier support")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/usb/musb/ux500.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c
index 8c2a43d992f5..14c5e986937e 100644
--- a/drivers/usb/musb/ux500.c
+++ b/drivers/usb/musb/ux500.c
@@ -155,6 +155,7 @@ static int ux500_musb_init(struct musb *musb)
 	status = usb_register_notifier(musb->xceiv, &musb->nb);
 	if (status < 0) {
 		dev_dbg(musb->controller, "notification register failed\n");
+		usb_put_phy(musb->xceiv);
 		return status;
 	}
 
-- 
2.34.1


             reply	other threads:[~2026-09-16 16:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 16:50 Wentao Liang [this message]
2026-09-16 17:33 ` Linus Walleij
2026-09-16 17:38 ` Greg KH
2026-11-07 16:46   ` [PATCH v2] " Wentao Liang

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=20260916165055.2085246-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=b-liu@ti.com \
    --cc=balbi@ti.com \
    --cc=fabio.baltieri@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linusw@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.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

all inboxes | Powered by JetHome®