[PATCH] cpufreq: apple-soc: Fix possible null-ptr-deref for cpufreq_cpu_get_raw()

Marc Zyngier maz at kernel.org
Mon Dec 30 01:30:53 PST 2024


On Mon, 30 Dec 2024 03:57:14 +0000,
Charles Han <hanchunchao at 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.



More information about the linux-arm-kernel mailing list