Re: [PATCH 1/8] platform/x86: thinkpad_acpi: remove early exit in hotkey_kthread()

From: Mark Pearson

Date: Thu Nov 26 2026 - 21:44:05 EST




On Wed, Nov 25, 2026, at 6:11 PM, Dmitry Torokhov wrote:
> hotkey_kthread() starts with an early return when tpacpi_lifecycle is
> TPACPI_LIFE_EXITING. A kthread started with kthread_run() and stopped
> via kthread_stop() must not exit before kthread_should_stop() returns
> true, otherwise its task_struct can be freed before
> hotkey_poll_stop_sync() calls kthread_stop().
>
> Remove the early return so hotkey_kthread() always waits for
> kthread_stop().
>
> Fixes: 01e88f25985d ("ACPI: thinkpad-acpi: add CMOS NVRAM polling for
> hot keys (v9)")
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> ---
> drivers/platform/x86/lenovo/thinkpad_acpi.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/platform/x86/lenovo/thinkpad_acpi.c
> b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> index 1bccc21ee29b..a586113ab1a7 100644
> --- a/drivers/platform/x86/lenovo/thinkpad_acpi.c
> +++ b/drivers/platform/x86/lenovo/thinkpad_acpi.c
> @@ -2451,9 +2451,6 @@ static int hotkey_kthread(void *data)
> unsigned int poll_freq;
> bool was_frozen;
>
> - if (tpacpi_lifecycle == TPACPI_LIFE_EXITING)
> - return 0;
> -
> set_freezable();
>
> so = 0;
>
> --
> 2.56.1.839.g22a8290db9-goog

This was implemented quite a long time ago :)
Change looks good to me

Reviewed-by: Mark Pearson <mpearson-lenovo@xxxxxxxxx>
Mark