Skip to content

Commit 1a677d0

Browse files
cuiyunhuigregkh
authored andcommitted
ACPI: CPPC: Fix NULL pointer dereference when nosmp is used
[ Upstream commit 15eece6 ] With nosmp in cmdline, other CPUs are not brought up, leaving their cpc_desc_ptr NULL. CPU0's iteration via for_each_possible_cpu() dereferences these NULL pointers, causing panic. Panic backtrace: [ 0.401123] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000b8 ... [ 0.403255] [<ffffffff809a5818>] cppc_allow_fast_switch+0x6a/0xd4 ... Kernel panic - not syncing: Attempted to kill init! Fixes: 3cc30dd ("cpufreq: CPPC: Enable fast_switch") Reported-by: Xu Lu <[email protected]> Signed-off-by: Yunhui Cui <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: New subject ] Signed-off-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 1fd4438 commit 1a677d0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/acpi/cppc_acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ bool cppc_allow_fast_switch(void)
463463
struct cpc_desc *cpc_ptr;
464464
int cpu;
465465

466-
for_each_possible_cpu(cpu) {
466+
for_each_present_cpu(cpu) {
467467
cpc_ptr = per_cpu(cpc_desc_ptr, cpu);
468468
desired_reg = &cpc_ptr->cpc_regs[DESIRED_PERF];
469469
if (!CPC_IN_SYSTEM_MEMORY(desired_reg) &&

0 commit comments

Comments
 (0)