From: Vineet Gupta <vgupta@kernel.org>
To: blaze <1466528493@qq.com>, vgupta@kernel.org
Cc: linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arc: kernel: Fix clk reference leak in show_cpuinfo()
Date: Wed, 9 Sep 2026 10:54:48 +0530 [thread overview]
Message-ID: <31a3ede9-3861-4837-a821-91cca14dd450@kernel.org> (raw)
In-Reply-To: <tencent_0F7ECDD4429624B3213BD758BED2F788490A@qq.com>
On 9/9/26 10:12 AM, blaze wrote:
> In show_cpuinfo(), clk_get() acquires a reference to the CPU clock, but
> clk_put() is never called to release it. Since show_cpuinfo() is the
> seq_file show callback for /proc/cpuinfo, this causes a clock reference
> count leak every time /proc/cpuinfo is read.
>
> The frequency is extracted via clk_get_rate() into a local variable, so
> the clock reference can be safely released immediately after.
>
> Fix this by calling clk_put(cpu_clk) right after clk_get_rate().
Thx for the fix and right on time as I was queuing up changes.
Acked-by: Vineet Gupta <vgupta@kernel.org>
Thx,
-Vineet
> Fixes: 98f2892607c5 ("ARC: [cpuinfo] Add clk info in /proc/cpuinfo")
> Signed-off-by: blaze<1466528493@qq.com>
> ---
> arch/arc/kernel/setup.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
> index 0000000..1111111 100644
> --- a/arch/arc/kernel/setup.c
> +++ b/arch/arc/kernel/setup.c
> @@ -593,6 +593,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
> cpu_id);
> } else {
> freq = clk_get_rate(cpu_clk);
> + clk_put(cpu_clk);
> }
> if (freq)
> seq_printf(m, "CPU speed\t: %lu.%02lu Mhz\n",
> --
> 2.43.0
>
prev parent reply other threads:[~2026-09-09 5:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 4:42 blaze
2026-09-09 5:24 ` Vineet Gupta [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=31a3ede9-3861-4837-a821-91cca14dd450@kernel.org \
--to=vgupta@kernel.org \
--cc=1466528493@qq.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.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®