]> git.hungrycats.org Git - linux/commit
cppc_cpufreq: Fix possible null pointer dereference
authorAleksandr Mishin <amishin@t-argos.ru>
Mon, 8 Apr 2024 09:35:36 +0000 (12:35 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 May 2024 07:49:12 +0000 (09:49 +0200)
commitb18daa4ec727c0266de5bfc78e818d168cc4aedf
tree2e54654f9680c27f879334a76766af9cfa5b5f11
parent075c0405b0d7d9fc490609e988a3af0069596538
cppc_cpufreq: Fix possible null pointer dereference

[ Upstream commit cf7de25878a1f4508c69dc9f6819c21ba177dbfe ]

cppc_cpufreq_get_rate() and hisi_cppc_cpufreq_get_rate() can be called from
different places with various parameters. So cpufreq_cpu_get() can return
null as 'policy' in some circumstances.
Fix this bug by adding null return check.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: a28b2bfc099c ("cppc_cpufreq: replace per-cpu data array with a list")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/cpufreq/cppc_cpufreq.c