Skip to content

Commit 7b5214d

Browse files
dhananjay-AMDpopcornmix
authored andcommitted
cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
commit 426db24 upstream. Check if policy is NULL before dereferencing it in amd_pstate_update. Fixes: e8f555d ("cpufreq/amd-pstate: fix setting policy current frequency value") Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Link: https://lore.kernel.org/r/20250205112523.201101-11-dhananjay.ugwekar@amd.com Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> [Minor context change fixed.] Signed-off-by: Wenshan Lan <jetlan9@163.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1f6158b commit 7b5214d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/cpufreq/amd-pstate.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
482482
u32 nominal_perf = READ_ONCE(cpudata->nominal_perf);
483483
u64 value = prev;
484484

485+
if (!policy)
486+
return;
487+
485488
min_perf = clamp_t(unsigned long, min_perf, cpudata->min_limit_perf,
486489
cpudata->max_limit_perf);
487490
max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf,

0 commit comments

Comments
 (0)