Draft: CVE-2024-38573: cppc_cpufreq: Fix possible null pointer dereference
requested to merge redhat/red-hat-ci-tools/kernel/bot-branches/centos-stream-9:backport-RHEL-44143-centos-stream-9-main into main
JIRA: https://issues.redhat.com/browse/RHEL-44143
CVE: CVE-2024-38573
cppc_cpufreq: Fix possible null pointer dereference
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>
(cherry picked from commit cf7de25878a1f4508c69dc9f6819c21ba177dbfe)
Signed-off-by: cki-backport-bot cki-ci-bot+cki-gitlab-backport-bot@redhat.com