Re: [PATCH v2] cpufreq: apple-soc: Fix null-ptr-deref in apple_soc_cpufreq_get_rate()

From: Viresh Kumar
Date: Thu Apr 10 2025 - 00:37:54 EST


On 09-04-25, 20:48, Henry Martin wrote:
> cpufreq_cpu_get_raw() can return NULL when the target CPU is not present
> in the policy->cpus mask. apple_soc_cpufreq_get_rate() does not check
> for this case, which results in a NULL pointer dereference.
>
> Fixes: 6286bbb40576 ("cpufreq: apple-soc: Add new driver to control Apple SoC CPU P-states")
> Signed-off-by: Henry Martin <bsdhenrymartin@xxxxxxxxx>
> ---
> V1 -> V2: Use `if (unlikely(!policy))` instead of `if (!policy)`
>
> drivers/cpufreq/apple-soc-cpufreq.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)

Applied. Thanks.

--
viresh