From: Wentao Liang <vulab@iscas.ac.cn>
To: andy.tang@nxp.com
Cc: bmasney@redhat.com, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org, mturquette@baylibre.com,
oss@buserror.net, robh@kernel.org, sboyd@kernel.org,
lkml@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH 2/6] clk: qoriq: Fix clock reference leak in input_clock_by_index()
Date: Tue, 15 Sep 2026 04:28:29 +0000 [thread overview]
Message-ID: <20260915042829.1725639-1-vulab@iscas.ac.cn> (raw)
input_clock_by_index() obtains a consumer clock with of_clk_get() and
hands it to input_clock(), which only uses __clk_get_name() to read the
clock name and then registers a new fixed factor clock. The consumer
clock itself is discarded without clk_put(), so the reference returned
by of_clk_get() is never released.
Release the reference with clk_put() once input_clock() is done with
the clock, mirroring the pattern used by of_clk_get_parent_name().
Fixes: 80b4ae7acea4 ("clk: qoriq: Separate root input clock for core PLLs on ls1012a")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/clk/clk-qoriq.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index 2524c5c0eb46..2ed8f93bc861 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -1135,13 +1135,16 @@ static struct clk __init *input_clock_by_name(const char *name,
static struct clk __init *input_clock_by_index(const char *name, int idx)
{
- struct clk *clk;
+ struct clk *clk, *ret;
clk = of_clk_get(clockgen.node, 0);
if (IS_ERR(clk))
return clk;
- return input_clock(name, clk);
+ ret = input_clock(name, clk);
+ clk_put(clk);
+
+ return ret;
}
static struct clk * __init create_sysclk(const char *name)
--
2.34.1
next reply other threads:[~2026-09-15 4:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 4:28 Wentao Liang [this message]
2026-09-27 16:02 ` Jerome Brunet
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=20260915042829.1725639-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=andy.tang@nxp.com \
--cc=bmasney@redhat.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkml@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=oss@buserror.net \
--cc=robh@kernel.org \
--cc=sboyd@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®