Skip to content

Commit 15736b2

Browse files
committed
Merge: cppc_cpufreq: Fix possible null pointer dereference
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4568 JIRA: https://issues.redhat.com/browse/RHEL-44143 CVE: CVE-2024-38573 Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com> Approved-by: Alessandro Carminati <acarmina@redhat.com> Approved-by: Lenny Szubowicz <lszubowi@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents 0b53f71 + a81c3f6 commit 15736b2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,10 +741,15 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
741741
{
742742
struct cppc_perf_fb_ctrs fb_ctrs_t0 = {0}, fb_ctrs_t1 = {0};
743743
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
744-
struct cppc_cpudata *cpu_data = policy->driver_data;
744+
struct cppc_cpudata *cpu_data;
745745
u64 delivered_perf;
746746
int ret;
747747

748+
if (!policy)
749+
return -ENODEV;
750+
751+
cpu_data = policy->driver_data;
752+
748753
cpufreq_cpu_put(policy);
749754

750755
ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t0);
@@ -822,10 +827,15 @@ static struct cpufreq_driver cppc_cpufreq_driver = {
822827
static unsigned int hisi_cppc_cpufreq_get_rate(unsigned int cpu)
823828
{
824829
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
825-
struct cppc_cpudata *cpu_data = policy->driver_data;
830+
struct cppc_cpudata *cpu_data;
826831
u64 desired_perf;
827832
int ret;
828833

834+
if (!policy)
835+
return -ENODEV;
836+
837+
cpu_data = policy->driver_data;
838+
829839
cpufreq_cpu_put(policy);
830840

831841
ret = cppc_get_desired_perf(cpu, &desired_perf);

0 commit comments

Comments
 (0)