Re: [PATCH v1 1/2] ACPI: processor: Update cpuidle driver check in __acpi_processor_start()

From: Rafael J. Wysocki

Date: Fri Sep 19 2025 - 07:17:39 EST


On Thu, Sep 18, 2025 at 11:10 PM Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
>
> From: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
>
> Commit 7a8c994cbb2d ("ACPI: processor: idle: Optimize ACPI idle
> driver registration") moved the ACPI idle driver registration to
> acpi_processor_driver_init() and acpi_processor_power_init() does
> not register an idle driver any more, so the cpuidle driver check
> in __acpi_processor_start() needs to be updated to avoid calling
> acpi_processor_power_init() without a cpuidle driver (in which
> case the registration of the cpuidle device in that function
> would fail anyway).

It's worse, it won't just fail, it'll lead to a NULL pointer
dereference in __cpuidle_register_device().

I'll update the changelog while applying the patch.


> Fixes: 7a8c994cbb2d ("ACPI: processor: idle: Optimize ACPI idle driver registration")
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
> ---
>
> Commit 7a8c994cbb2d is only in linux-next at this point.
>
> ---
> drivers/acpi/processor_driver.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/drivers/acpi/processor_driver.c
> +++ b/drivers/acpi/processor_driver.c
> @@ -166,7 +166,7 @@ static int __acpi_processor_start(struct
> if (result && !IS_ENABLED(CONFIG_ACPI_CPU_FREQ_PSS))
> dev_dbg(&device->dev, "CPPC data invalid or not present\n");
>
> - if (!cpuidle_get_driver() || cpuidle_get_driver() == &acpi_idle_driver)
> + if (cpuidle_get_driver() == &acpi_idle_driver)
> acpi_processor_power_init(pr);
>
> acpi_pss_perf_init(pr);
>
>
>
>