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

From: lihuisong (C)

Date: Sun Sep 21 2025 - 21:16:43 EST



在 2025/9/19 19:17, Rafael J. Wysocki 写道:
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.
Yeah, thanks for fixing it.
Acked-by: lihuisong@xxxxxxxxxx

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);