From: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
To: Miaoqian Lin <linmq006@gmail.com>
Cc: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Felipe Balbi <felipe.balbi@linux.intel.com>,
Robin Murphy <robin.murphy@arm.com>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: of-simple: fix clock resource leak in dwc3_of_simple_probe
Date: Tue, 16 Dec 2025 23:06:26 +0000 [thread overview]
Message-ID: <20251216230624.kcztn2cqcaohtzip@synopsys.com> (raw)
In-Reply-To: <20251211064937.2360510-1-linmq006@gmail.com>
On Thu, Dec 11, 2025, Miaoqian Lin wrote:
> When clk_bulk_prepare_enable() fails, the error path jumps to
> err_resetc_assert, skipping clk_bulk_put_all() and leaking the
> clock references acquired by clk_bulk_get_all().
>
> Add err_clk_put_all label to properly release clock resources
> in all error paths.
>
> Found via static analysis and code review.
>
> Fixes: c0c61471ef86 ("usb: dwc3: of-simple: Convert to bulk clk API")
> Cc: stable@vger.kernel.org
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> drivers/usb/dwc3/dwc3-of-simple.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
> index a4954a21be93..c116143335d9 100644
> --- a/drivers/usb/dwc3/dwc3-of-simple.c
> +++ b/drivers/usb/dwc3/dwc3-of-simple.c
> @@ -70,11 +70,11 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
> simple->num_clocks = ret;
> ret = clk_bulk_prepare_enable(simple->num_clocks, simple->clks);
> if (ret)
> - goto err_resetc_assert;
> + goto err_clk_put_all;
>
> ret = of_platform_populate(np, NULL, NULL, dev);
> if (ret)
> - goto err_clk_put;
> + goto err_clk_disable;
>
> pm_runtime_set_active(dev);
> pm_runtime_enable(dev);
> @@ -82,8 +82,9 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
>
> return 0;
>
> -err_clk_put:
> +err_clk_disable:
> clk_bulk_disable_unprepare(simple->num_clocks, simple->clks);
> +err_clk_put_all:
> clk_bulk_put_all(simple->num_clocks, simple->clks);
>
> err_resetc_assert:
> --
> 2.25.1
>
Thanks for the catch!
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
BR,
Thinh
prev parent reply other threads:[~2025-12-16 23:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-11 6:49 Miaoqian Lin
2025-12-16 23:06 ` Thinh Nguyen [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=20251216230624.kcztn2cqcaohtzip@synopsys.com \
--to=thinh.nguyen@synopsys.com \
--cc=felipe.balbi@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linmq006@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=robin.murphy@arm.com \
--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®