Skip to content

Commit 1d976b8

Browse files
dhananjay-AMDSasha Levin
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 <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Reviewed-by: Gautham R. Shenoy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mario Limonciello <[email protected]> [Minor context change fixed.] Signed-off-by: Wenshan Lan <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 94fa65d commit 1d976b8

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)