Skip to content

Commit 47e6a86

Browse files
LiHuiSong1rafaeljw
authored andcommitted
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>
1 parent 02c68ed commit 47e6a86

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

drivers/acpi/processor_idle.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,16 +1267,15 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
12671267

12681268
int acpi_processor_hotplug(struct acpi_processor *pr)
12691269
{
1270+
struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id);
12701271
int ret = 0;
1271-
struct cpuidle_device *dev;
12721272

12731273
if (disabled_by_idle_boot_param())
12741274
return 0;
12751275

1276-
if (!pr->flags.power_setup_done)
1276+
if (!pr->flags.power_setup_done || !dev)
12771277
return -ENODEV;
12781278

1279-
dev = per_cpu(acpi_cpuidle_device, pr->id);
12801279
cpuidle_pause_and_lock();
12811280
cpuidle_disable_device(dev);
12821281
ret = acpi_processor_get_power_info(pr);

0 commit comments

Comments
 (0)