]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ACPI: button: Fix ACPI GPE handler leak during removal
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 22 May 2026 14:49:44 +0000 (16:49 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 25 May 2026 07:52:33 +0000 (09:52 +0200)
Commit a7e23ec17fee ("ACPI: button: Install notifier for system events
as well") changed the ACPI notify handler type for ACPI buttons to
ACPI_ALL_NOTIFY, but it forgot to update acpi_button_remove() to reflect
that change.  This leads to leaking the notify handler past driver
removal, which may cause a kernel crash to occur if ACPI notify on
the given device is triggered after removing the driver, and causes a
subsequent probe of the given device with the same driver to fail.

Address this by updating the acpi_remove_notify_handler() call in
acpi_button_remove() as appropriate.

Fixes: a7e23ec17fee ("ACPI: button: Install notifier for system events as well")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Cc: 6.15+ <stable@vger.kernel.org> # 6.15+
Link: https://patch.msgid.link/7954431.EvYhyI6sBW@rafael.j.wysocki
drivers/acpi/button.c

index b47301ee4c8a829a3be39de07ef97810d4929165..7c2e1a422ba01a018b0405cd04299cf8d0e06e98 100644 (file)
@@ -689,7 +689,7 @@ static void acpi_button_remove(struct platform_device *pdev)
                                                acpi_button_event);
                break;
        default:
-               acpi_remove_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY,
+               acpi_remove_notify_handler(adev->handle, ACPI_ALL_NOTIFY,
                                           button->type == ACPI_BUTTON_TYPE_LID ?
                                                acpi_lid_notify :
                                                acpi_button_notify);