From: Sudeep Holla <sudeep.holla@arm.com>
To: Charles Han <hanchunchao@inspur.com>
Cc: <cristian.marussi@arm.com>, <rafael@kernel.org>,
Sudeep Holla <sudeep.holla@arm.com>, <viresh.kumar@linaro.org>,
<arm-scmi@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: scpi: Prevent null pointer dereference in scpi_cpufreq_get_rate()
Date: Thu, 2 Jan 2025 09:48:28 +0000 [thread overview]
Message-ID: <Z3Zg7PHdGAzXsyMg@bogus> (raw)
In-Reply-To: <20241230093159.258813-1-hanchunchao@inspur.com>
On Mon, Dec 30, 2024 at 05:31:59PM +0800, Charles Han wrote:
> cpufreq_cpu_get_raw() may return NULL if the cpu is not in
> policy->cpus cpu mask and it will cause null pointer dereference.
> Prevent null pointer dereference in scpi_cpufreq_get_rate().
>
Can you please fix such occurrences in other places too ?
I see it in apple-soc-cpufreq.c and scmi-cpufreq.c as well.
> Fixes: 343a8d17fa8d ("cpufreq: scpi: remove arm_big_little dependency")
> Signed-off-by: Charles Han <hanchunchao@inspur.com>
> ---
> drivers/cpufreq/scpi-cpufreq.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c
> index cd89c1b9832c..c888ed3a0de9 100644
> --- a/drivers/cpufreq/scpi-cpufreq.c
> +++ b/drivers/cpufreq/scpi-cpufreq.c
> @@ -30,6 +30,9 @@ static struct scpi_ops *scpi_ops;
> static unsigned int scpi_cpufreq_get_rate(unsigned int cpu)
> {
> struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu);
> + if (unlikely(!policy))
> + return 0;
> +
> struct scpi_data *priv = policy->driver_data;
> unsigned long rate = clk_get_rate(priv->clk);
>
--
Regards,
Sudeep
prev parent reply other threads:[~2025-01-02 9:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 9:31 [PATCH] cpufreq: scpi: Prevent null pointer dereference in scpi_cpufreq_get_rate() Charles Han
2025-01-02 5:00 ` Viresh Kumar
2025-01-02 9:48 ` Sudeep Holla [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=Z3Zg7PHdGAzXsyMg@bogus \
--to=sudeep.holla@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=hanchunchao@inspur.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.