Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ACPI: processor: idle: Fix NULL pointer dereference in hotplug path

A cpuidle_device might fail to register during boot, but the system can
continue to run. In such cases, acpi_processor_hotplug() can trigger
a NULL pointer dereference when accessing the per-cpu acpi_cpuidle_device.

So add NULL pointer check for the per-cpu acpi_cpuidle_device in
acpi_processor_hotplug.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Link: https://patch.msgid.link/20260403090253.998322-1-lihuisong@huawei.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

authored by

Huisong Li and committed by
Rafael J. Wysocki
47e6a863 02c68ed1

+2 -3
+2 -3
drivers/acpi/processor_idle.c
··· 1267 1267 1268 1268 int acpi_processor_hotplug(struct acpi_processor *pr) 1269 1269 { 1270 + struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); 1270 1271 int ret = 0; 1271 - struct cpuidle_device *dev; 1272 1272 1273 1273 if (disabled_by_idle_boot_param()) 1274 1274 return 0; 1275 1275 1276 - if (!pr->flags.power_setup_done) 1276 + if (!pr->flags.power_setup_done || !dev) 1277 1277 return -ENODEV; 1278 1278 1279 - dev = per_cpu(acpi_cpuidle_device, pr->id); 1280 1279 cpuidle_pause_and_lock(); 1281 1280 cpuidle_disable_device(dev); 1282 1281 ret = acpi_processor_get_power_info(pr);