From: Marc Zyngier <maz@kernel.org>
To: Charles Han <hanchunchao@inspur.com>
Cc: <marcan@marcan.st>, <sven@svenpeter.dev>, <alyssa@rosenzweig.io>,
<rafael@kernel.org>, <viresh.kumar@linaro.org>,
<asahi@lists.linux.dev>, <linux-arm-kernel@lists.infradead.org>,
<linux-pm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] cpufreq: apple-soc: Fix possible null-ptr-deref for cpufreq_cpu_get_raw()
Date: Mon, 30 Dec 2024 09:30:53 +0000 [thread overview]
Message-ID: <86ikr1plf6.wl-maz@kernel.org> (raw)
In-Reply-To: <20241230035714.72780-1-hanchunchao@inspur.com>
On Mon, 30 Dec 2024 03:57:14 +0000,
Charles Han <hanchunchao@inspur.com> 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.
> But this returned value in apple_soc_cpufreq_get_rate() is not
> checked. Add NULL check in apple_soc_cpufreq_get_rate(), to handle
> kernel NULL pointer dereference error.
The only way I can see a CPU not having an assigned policy is when the
DT is incomplete. And even then, reaching this code path doesn't look
obvious to me.
Can you describe how you get into this situation?
Thanks,
M.
--
Without deviation from the norm, progress is not possible.
prev parent reply other threads:[~2024-12-30 9:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-30 3:57 [PATCH] cpufreq: apple-soc: Fix possible null-ptr-deref for cpufreq_cpu_get_raw() Charles Han
2024-12-30 7:25 ` Markus Elfring
2024-12-30 9:30 ` Marc Zyngier [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=86ikr1plf6.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=hanchunchao@inspur.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=rafael@kernel.org \
--cc=sven@svenpeter.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).