From: Sasha Levin Date: Mon, 13 Apr 2026 22:20:18 +0000 (-0400) Subject: drop ACPI EC patches from queue-5.15 and queue-5.10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5fc1e54e617d307e5c4c6597d12a971e419349ec;p=thirdparty%2Fkernel%2Fstable-queue.git drop ACPI EC patches from queue-5.15 and queue-5.10 Dropped patches: - "ACPI: EC: Install address space handler at the namespace root" Queues: 5.15, 5.10 Reason: causes regressions (EC operation region issues on systems with non-present devices); follow-up fix 71bf41b8e913 not included in either queue Report: https://lore.kernel.org/stable/dce92963d28f3419e014c428a0b243f4fe638109.camel@decadent.org.uk/ - "ACPI: EC: clean up handlers on probe failure in acpi_ec_setup()" Queues: 5.15, 5.10 Reason: depends on dropped address space handler patch (Stable-dep-of) - "ACPI: EC: Evaluate orphan _REG under EC device" Queues: 5.15 Reason: this is an incomplete fix (reverted upstream by 779bac999445, replaced by 71bf41b8e913) and depends on dropped address space handler patch --- diff --git a/queue-5.10/acpi-ec-clean-up-handlers-on-probe-failure-in-acpi_e.patch b/queue-5.10/acpi-ec-clean-up-handlers-on-probe-failure-in-acpi_e.patch deleted file mode 100644 index 4b76e1bfe4..0000000000 --- a/queue-5.10/acpi-ec-clean-up-handlers-on-probe-failure-in-acpi_e.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 7a3b884834625ff8d0d4e7a8cdf105920ba6fc16 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 25 Mar 2026 00:54:59 +0800 -Subject: ACPI: EC: clean up handlers on probe failure in acpi_ec_setup() - -From: Weiming Shi - -[ Upstream commit f6484cadbcaf26b5844b51bd7307a663dda48ef6 ] - -When ec_install_handlers() returns -EPROBE_DEFER on reduced-hardware -platforms, it has already started the EC and installed the address -space handler with the struct acpi_ec pointer as handler context. -However, acpi_ec_setup() propagates the error without any cleanup. - -The caller acpi_ec_add() then frees the struct acpi_ec for non-boot -instances, leaving a dangling handler context in ACPICA. - -Any subsequent AML evaluation that accesses an EC OpRegion field -dispatches into acpi_ec_space_handler() with the freed pointer, -causing a use-after-free: - - BUG: KASAN: slab-use-after-free in mutex_lock (kernel/locking/mutex.c:289) - Write of size 8 at addr ffff88800721de38 by task init/1 - Call Trace: - - mutex_lock (kernel/locking/mutex.c:289) - acpi_ec_space_handler (drivers/acpi/ec.c:1362) - acpi_ev_address_space_dispatch (drivers/acpi/acpica/evregion.c:293) - acpi_ex_access_region (drivers/acpi/acpica/exfldio.c:246) - acpi_ex_field_datum_io (drivers/acpi/acpica/exfldio.c:509) - acpi_ex_extract_from_field (drivers/acpi/acpica/exfldio.c:700) - acpi_ex_read_data_from_field (drivers/acpi/acpica/exfield.c:327) - acpi_ex_resolve_node_to_value (drivers/acpi/acpica/exresolv.c:392) - - - Allocated by task 1: - acpi_ec_alloc (drivers/acpi/ec.c:1424) - acpi_ec_add (drivers/acpi/ec.c:1692) - - Freed by task 1: - kfree (mm/slub.c:6876) - acpi_ec_add (drivers/acpi/ec.c:1751) - -The bug triggers on reduced-hardware EC platforms (ec->gpe < 0) -when the GPIO IRQ provider defers probing. Once the stale handler -exists, any unprivileged sysfs read that causes AML to touch an -EC OpRegion (battery, thermal, backlight) exercises the dangling -pointer. - -Fix this by calling ec_remove_handlers() in the error path of -acpi_ec_setup() before clearing first_ec. ec_remove_handlers() -checks each EC_FLAGS_* bit before acting, so it is safe to call -regardless of how far ec_install_handlers() progressed: - - -ENODEV (handler not installed): only calls acpi_ec_stop() - -EPROBE_DEFER (handler installed): removes handler, stops EC - -Fixes: 03e9a0e05739 ("ACPI: EC: Consolidate event handler installation code") -Reported-by: Xiang Mei -Signed-off-by: Weiming Shi -Link: https://patch.msgid.link/20260324165458.1337233-2-bestswngs@gmail.com -Signed-off-by: Rafael J. Wysocki -Signed-off-by: Sasha Levin ---- - drivers/acpi/ec.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c -index 1d7e7e47ea0e4..aaf0add0dc081 100644 ---- a/drivers/acpi/ec.c -+++ b/drivers/acpi/ec.c -@@ -1636,6 +1636,8 @@ static int acpi_ec_setup(struct acpi_ec *ec, struct acpi_device *device, bool ca - - ret = ec_install_handlers(ec, device, call_reg); - if (ret) { -+ ec_remove_handlers(ec); -+ - if (ec == first_ec) - first_ec = NULL; - --- -2.53.0 - diff --git a/queue-5.10/acpi-ec-install-address-space-handler-at-the-namespa.patch b/queue-5.10/acpi-ec-install-address-space-handler-at-the-namespa.patch deleted file mode 100644 index b175a40ce2..0000000000 --- a/queue-5.10/acpi-ec-install-address-space-handler-at-the-namespa.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 514c9d3959d766ac3a578cd1b42e88a3293fc078 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 15 May 2024 21:40:54 +0200 -Subject: ACPI: EC: Install address space handler at the namespace root - -From: Rafael J. Wysocki - -[ Upstream commit 60fa6ae6e6d09e377fce6f8d9b6f6a4d88769f63 ] - -It is reported that _DSM evaluation fails in ucsi_acpi_dsm() on Lenovo -IdeaPad Pro 5 due to a missing address space handler for the EC address -space: - - ACPI Error: No handler for Region [ECSI] (000000007b8176ee) [EmbeddedControl] (20230628/evregion-130) - -This happens because if there is no ECDT, the EC driver only registers -the EC address space handler for operation regions defined in the EC -device scope of the ACPI namespace while the operation region being -accessed by the _DSM in question is located beyond that scope. - -To address this, modify the ACPI EC driver to install the EC address -space handler at the root of the ACPI namespace for the first EC that -can be found regardless of whether or not an ECDT is present. - -Note that this change is consistent with some examples in the ACPI -specification in which EC operation regions located outside the EC -device scope are used (for example, see Section 9.17.15 in ACPI 6.5), -so the current behavior of the EC driver is arguably questionable. - -Reported-by: webcaptcha -Link: https://bugzilla.kernel.org/show_bug.cgi?id=218789 -Link: https://uefi.org/specs/ACPI/6.5/09_ACPI_Defined_Devices_and_Device_Specific_Objects.html#example-asl-code -Link: https://lore.kernel.org/linux-acpi/Zi+0whTvDbAdveHq@kuha.fi.intel.com -Suggested-by: Heikki Krogerus -Signed-off-by: Rafael J. Wysocki -Reviewed-by: Hans de Goede -Reviewed-by: Mario Limonciello -Reviewed-by: Andy Shevchenko -Stable-dep-of: f6484cadbcaf ("ACPI: EC: clean up handlers on probe failure in acpi_ec_setup()") -Signed-off-by: Sasha Levin ---- - drivers/acpi/ec.c | 25 ++++++++++++++++--------- - drivers/acpi/internal.h | 1 - - 2 files changed, 16 insertions(+), 10 deletions(-) - -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c -index 10f7e3ef58791..1d7e7e47ea0e4 100644 ---- a/drivers/acpi/ec.c -+++ b/drivers/acpi/ec.c -@@ -1514,13 +1514,14 @@ static bool install_gpio_irq_event_handler(struct acpi_ec *ec) - static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, - bool call_reg) - { -+ acpi_handle scope_handle = ec == first_ec ? ACPI_ROOT_OBJECT : ec->handle; - acpi_status status; - - acpi_ec_start(ec, false); - - if (!test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) { - acpi_ec_enter_noirq(ec); -- status = acpi_install_address_space_handler_no_reg(ec->handle, -+ status = acpi_install_address_space_handler_no_reg(scope_handle, - ACPI_ADR_SPACE_EC, - &acpi_ec_space_handler, - NULL, ec); -@@ -1529,11 +1530,10 @@ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, - return -ENODEV; - } - set_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags); -- ec->address_space_handler_holder = ec->handle; - } - - if (call_reg && !test_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags)) { -- acpi_execute_reg_methods(ec->handle, ACPI_ADR_SPACE_EC); -+ acpi_execute_reg_methods(scope_handle, ACPI_ADR_SPACE_EC); - set_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags); - } - -@@ -1585,10 +1585,13 @@ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, - - static void ec_remove_handlers(struct acpi_ec *ec) - { -+ acpi_handle scope_handle = ec == first_ec ? ACPI_ROOT_OBJECT : ec->handle; -+ - if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) { - if (ACPI_FAILURE(acpi_remove_address_space_handler( -- ec->address_space_handler_holder, -- ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) -+ scope_handle, -+ ACPI_ADR_SPACE_EC, -+ &acpi_ec_space_handler))) - pr_err("failed to remove space handler\n"); - clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags); - } -@@ -1627,14 +1630,18 @@ static int acpi_ec_setup(struct acpi_ec *ec, struct acpi_device *device, bool ca - { - int ret; - -- ret = ec_install_handlers(ec, device, call_reg); -- if (ret) -- return ret; -- - /* First EC capable of handling transactions */ - if (!first_ec) - first_ec = ec; - -+ ret = ec_install_handlers(ec, device, call_reg); -+ if (ret) { -+ if (ec == first_ec) -+ first_ec = NULL; -+ -+ return ret; -+ } -+ - pr_info("EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n", ec->command_addr, - ec->data_addr); - -diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h -index 4edf591f8a3a5..f6c929787c9e6 100644 ---- a/drivers/acpi/internal.h -+++ b/drivers/acpi/internal.h -@@ -169,7 +169,6 @@ static inline void acpi_early_processor_osc(void) {} - -------------------------------------------------------------------------- */ - struct acpi_ec { - acpi_handle handle; -- acpi_handle address_space_handler_holder; - int gpe; - int irq; - unsigned long command_addr; --- -2.53.0 - diff --git a/queue-5.10/series b/queue-5.10/series index 07afb67209..2eba268ac9 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -287,8 +287,6 @@ acpica-include-acpi-acpixf.h-fix-indentation.patch acpica-allow-address_space_handler-install-and-_reg-.patch acpi-ec-fix-ec-address-space-handler-unregistration.patch acpi-ec-fix-ecdt-probe-ordering-issues.patch -acpi-ec-install-address-space-handler-at-the-namespa.patch -acpi-ec-clean-up-handlers-on-probe-failure-in-acpi_e.patch hwmon-adm1177-fix-sysfs-abi-violation-and-current-un.patch sysctl-fix-uninitialized-variable-in-proc_do_large_b.patch spi-spi-fsl-lpspi-fix-teardown-order-issue-uaf.patch diff --git a/queue-5.15/acpi-ec-clean-up-handlers-on-probe-failure-in-acpi_e.patch b/queue-5.15/acpi-ec-clean-up-handlers-on-probe-failure-in-acpi_e.patch deleted file mode 100644 index cd6cfff88f..0000000000 --- a/queue-5.15/acpi-ec-clean-up-handlers-on-probe-failure-in-acpi_e.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 5df19c7f7af6a069de3b21efa641659f5ef42837 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 25 Mar 2026 00:54:59 +0800 -Subject: ACPI: EC: clean up handlers on probe failure in acpi_ec_setup() - -From: Weiming Shi - -[ Upstream commit f6484cadbcaf26b5844b51bd7307a663dda48ef6 ] - -When ec_install_handlers() returns -EPROBE_DEFER on reduced-hardware -platforms, it has already started the EC and installed the address -space handler with the struct acpi_ec pointer as handler context. -However, acpi_ec_setup() propagates the error without any cleanup. - -The caller acpi_ec_add() then frees the struct acpi_ec for non-boot -instances, leaving a dangling handler context in ACPICA. - -Any subsequent AML evaluation that accesses an EC OpRegion field -dispatches into acpi_ec_space_handler() with the freed pointer, -causing a use-after-free: - - BUG: KASAN: slab-use-after-free in mutex_lock (kernel/locking/mutex.c:289) - Write of size 8 at addr ffff88800721de38 by task init/1 - Call Trace: - - mutex_lock (kernel/locking/mutex.c:289) - acpi_ec_space_handler (drivers/acpi/ec.c:1362) - acpi_ev_address_space_dispatch (drivers/acpi/acpica/evregion.c:293) - acpi_ex_access_region (drivers/acpi/acpica/exfldio.c:246) - acpi_ex_field_datum_io (drivers/acpi/acpica/exfldio.c:509) - acpi_ex_extract_from_field (drivers/acpi/acpica/exfldio.c:700) - acpi_ex_read_data_from_field (drivers/acpi/acpica/exfield.c:327) - acpi_ex_resolve_node_to_value (drivers/acpi/acpica/exresolv.c:392) - - - Allocated by task 1: - acpi_ec_alloc (drivers/acpi/ec.c:1424) - acpi_ec_add (drivers/acpi/ec.c:1692) - - Freed by task 1: - kfree (mm/slub.c:6876) - acpi_ec_add (drivers/acpi/ec.c:1751) - -The bug triggers on reduced-hardware EC platforms (ec->gpe < 0) -when the GPIO IRQ provider defers probing. Once the stale handler -exists, any unprivileged sysfs read that causes AML to touch an -EC OpRegion (battery, thermal, backlight) exercises the dangling -pointer. - -Fix this by calling ec_remove_handlers() in the error path of -acpi_ec_setup() before clearing first_ec. ec_remove_handlers() -checks each EC_FLAGS_* bit before acting, so it is safe to call -regardless of how far ec_install_handlers() progressed: - - -ENODEV (handler not installed): only calls acpi_ec_stop() - -EPROBE_DEFER (handler installed): removes handler, stops EC - -Fixes: 03e9a0e05739 ("ACPI: EC: Consolidate event handler installation code") -Reported-by: Xiang Mei -Signed-off-by: Weiming Shi -Link: https://patch.msgid.link/20260324165458.1337233-2-bestswngs@gmail.com -Signed-off-by: Rafael J. Wysocki -Signed-off-by: Sasha Levin ---- - drivers/acpi/ec.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c -index 8b54e8fe4a808..25de4e6b4c2ed 100644 ---- a/drivers/acpi/ec.c -+++ b/drivers/acpi/ec.c -@@ -1623,6 +1623,8 @@ static int acpi_ec_setup(struct acpi_ec *ec, struct acpi_device *device, bool ca - - ret = ec_install_handlers(ec, device, call_reg); - if (ret) { -+ ec_remove_handlers(ec); -+ - if (ec == first_ec) - first_ec = NULL; - --- -2.53.0 - diff --git a/queue-5.15/acpi-ec-evaluate-orphan-_reg-under-ec-device.patch b/queue-5.15/acpi-ec-evaluate-orphan-_reg-under-ec-device.patch deleted file mode 100644 index 64d52456c7..0000000000 --- a/queue-5.15/acpi-ec-evaluate-orphan-_reg-under-ec-device.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 0e6b6dedf16800df0ff73ffe2bb5066514db29c2 Mon Sep 17 00:00:00 2001 -From: "Rafael J. Wysocki" -Date: Wed, 12 Jun 2024 16:15:55 +0200 -Subject: ACPI: EC: Evaluate orphan _REG under EC device - -From: Rafael J. Wysocki - -commit 0e6b6dedf16800df0ff73ffe2bb5066514db29c2 upstream. - -After starting to install the EC address space handler at the ACPI -namespace root, if there is an "orphan" _REG method in the EC device's -scope, it will not be evaluated any more. This breaks EC operation -regions on some systems, like Asus gu605. - -To address this, use a wrapper around an existing ACPICA function to -look for an "orphan" _REG method in the EC device scope and evaluate -it if present. - -Fixes: 60fa6ae6e6d0 ("ACPI: EC: Install address space handler at the namespace root") -Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218945 -Reported-by: VitaliiT -Tested-by: VitaliiT -Signed-off-by: Rafael J. Wysocki -Signed-off-by: Greg Kroah-Hartman ---- - drivers/acpi/acpica/acevents.h | 4 +++ - drivers/acpi/acpica/evregion.c | 6 ---- - drivers/acpi/acpica/evxfregn.c | 54 +++++++++++++++++++++++++++++++++++++++++ - drivers/acpi/ec.c | 3 ++ - include/acpi/acpixf.h | 4 +++ - 5 files changed, 66 insertions(+), 5 deletions(-) - ---- a/drivers/acpi/acpica/acevents.h -+++ b/drivers/acpi/acpica/acevents.h -@@ -191,6 +191,10 @@ void - acpi_ev_execute_reg_methods(struct acpi_namespace_node *node, - acpi_adr_space_type space_id, u32 function); - -+void -+acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *node, -+ acpi_adr_space_type space_id); -+ - acpi_status - acpi_ev_execute_reg_method(union acpi_operand_object *region_obj, u32 function); - ---- a/drivers/acpi/acpica/evregion.c -+++ b/drivers/acpi/acpica/evregion.c -@@ -20,10 +20,6 @@ extern u8 acpi_gbl_default_address_space - - /* Local prototypes */ - --static void --acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node, -- acpi_adr_space_type space_id); -- - static acpi_status - acpi_ev_reg_run(acpi_handle obj_handle, - u32 level, void *context, void **return_value); -@@ -799,7 +795,7 @@ acpi_ev_reg_run(acpi_handle obj_handle, - * - ******************************************************************************/ - --static void -+void - acpi_ev_execute_orphan_reg_method(struct acpi_namespace_node *device_node, - acpi_adr_space_type space_id) - { ---- a/drivers/acpi/acpica/evxfregn.c -+++ b/drivers/acpi/acpica/evxfregn.c -@@ -304,3 +304,57 @@ acpi_execute_reg_methods(acpi_handle dev - } - - ACPI_EXPORT_SYMBOL(acpi_execute_reg_methods) -+ -+/******************************************************************************* -+ * -+ * FUNCTION: acpi_execute_orphan_reg_method -+ * -+ * PARAMETERS: device - Handle for the device -+ * space_id - The address space ID -+ * -+ * RETURN: Status -+ * -+ * DESCRIPTION: Execute an "orphan" _REG method that appears under an ACPI -+ * device. This is a _REG method that has no corresponding region -+ * within the device's scope. -+ * -+ ******************************************************************************/ -+acpi_status -+acpi_execute_orphan_reg_method(acpi_handle device, acpi_adr_space_type space_id) -+{ -+ struct acpi_namespace_node *node; -+ acpi_status status; -+ -+ ACPI_FUNCTION_TRACE(acpi_execute_orphan_reg_method); -+ -+ /* Parameter validation */ -+ -+ if (!device) { -+ return_ACPI_STATUS(AE_BAD_PARAMETER); -+ } -+ -+ status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); -+ if (ACPI_FAILURE(status)) { -+ return_ACPI_STATUS(status); -+ } -+ -+ /* Convert and validate the device handle */ -+ -+ node = acpi_ns_validate_handle(device); -+ if (node) { -+ -+ /* -+ * If an "orphan" _REG method is present in the device's scope -+ * for the given address space ID, run it. -+ */ -+ -+ acpi_ev_execute_orphan_reg_method(node, space_id); -+ } else { -+ status = AE_BAD_PARAMETER; -+ } -+ -+ (void)acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); -+ return_ACPI_STATUS(status); -+} -+ -+ACPI_EXPORT_SYMBOL(acpi_execute_orphan_reg_method) ---- a/drivers/acpi/ec.c -+++ b/drivers/acpi/ec.c -@@ -1521,6 +1521,9 @@ static int ec_install_handlers(struct ac - - if (call_reg && !test_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags)) { - acpi_execute_reg_methods(scope_handle, ACPI_ADR_SPACE_EC); -+ if (scope_handle != ec->handle) -+ acpi_execute_orphan_reg_method(ec->handle, ACPI_ADR_SPACE_EC); -+ - set_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags); - } - ---- a/include/acpi/acpixf.h -+++ b/include/acpi/acpixf.h -@@ -661,6 +661,10 @@ ACPI_EXTERNAL_RETURN_STATUS(acpi_status - acpi_adr_space_type - space_id)) - ACPI_EXTERNAL_RETURN_STATUS(acpi_status -+ acpi_execute_orphan_reg_method(acpi_handle device, -+ acpi_adr_space_type -+ space_id)) -+ACPI_EXTERNAL_RETURN_STATUS(acpi_status - acpi_remove_address_space_handler(acpi_handle - device, - acpi_adr_space_type diff --git a/queue-5.15/acpi-ec-install-address-space-handler-at-the-namespa.patch b/queue-5.15/acpi-ec-install-address-space-handler-at-the-namespa.patch deleted file mode 100644 index ca5245849b..0000000000 --- a/queue-5.15/acpi-ec-install-address-space-handler-at-the-namespa.patch +++ /dev/null @@ -1,132 +0,0 @@ -From 207a8573d60a18fde9dae1f9e5a21bf4a74d2012 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 15 May 2024 21:40:54 +0200 -Subject: ACPI: EC: Install address space handler at the namespace root - -From: Rafael J. Wysocki - -[ Upstream commit 60fa6ae6e6d09e377fce6f8d9b6f6a4d88769f63 ] - -It is reported that _DSM evaluation fails in ucsi_acpi_dsm() on Lenovo -IdeaPad Pro 5 due to a missing address space handler for the EC address -space: - - ACPI Error: No handler for Region [ECSI] (000000007b8176ee) [EmbeddedControl] (20230628/evregion-130) - -This happens because if there is no ECDT, the EC driver only registers -the EC address space handler for operation regions defined in the EC -device scope of the ACPI namespace while the operation region being -accessed by the _DSM in question is located beyond that scope. - -To address this, modify the ACPI EC driver to install the EC address -space handler at the root of the ACPI namespace for the first EC that -can be found regardless of whether or not an ECDT is present. - -Note that this change is consistent with some examples in the ACPI -specification in which EC operation regions located outside the EC -device scope are used (for example, see Section 9.17.15 in ACPI 6.5), -so the current behavior of the EC driver is arguably questionable. - -Reported-by: webcaptcha -Link: https://bugzilla.kernel.org/show_bug.cgi?id=218789 -Link: https://uefi.org/specs/ACPI/6.5/09_ACPI_Defined_Devices_and_Device_Specific_Objects.html#example-asl-code -Link: https://lore.kernel.org/linux-acpi/Zi+0whTvDbAdveHq@kuha.fi.intel.com -Suggested-by: Heikki Krogerus -Signed-off-by: Rafael J. Wysocki -Reviewed-by: Hans de Goede -Reviewed-by: Mario Limonciello -Reviewed-by: Andy Shevchenko -Stable-dep-of: f6484cadbcaf ("ACPI: EC: clean up handlers on probe failure in acpi_ec_setup()") -Signed-off-by: Sasha Levin ---- - drivers/acpi/ec.c | 25 ++++++++++++++++--------- - drivers/acpi/internal.h | 1 - - 2 files changed, 16 insertions(+), 10 deletions(-) - -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c -index bbc0cfb8fc81b..8b54e8fe4a808 100644 ---- a/drivers/acpi/ec.c -+++ b/drivers/acpi/ec.c -@@ -1501,13 +1501,14 @@ static bool install_gpio_irq_event_handler(struct acpi_ec *ec) - static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, - bool call_reg) - { -+ acpi_handle scope_handle = ec == first_ec ? ACPI_ROOT_OBJECT : ec->handle; - acpi_status status; - - acpi_ec_start(ec, false); - - if (!test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) { - acpi_ec_enter_noirq(ec); -- status = acpi_install_address_space_handler_no_reg(ec->handle, -+ status = acpi_install_address_space_handler_no_reg(scope_handle, - ACPI_ADR_SPACE_EC, - &acpi_ec_space_handler, - NULL, ec); -@@ -1516,11 +1517,10 @@ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, - return -ENODEV; - } - set_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags); -- ec->address_space_handler_holder = ec->handle; - } - - if (call_reg && !test_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags)) { -- acpi_execute_reg_methods(ec->handle, ACPI_ADR_SPACE_EC); -+ acpi_execute_reg_methods(scope_handle, ACPI_ADR_SPACE_EC); - set_bit(EC_FLAGS_EC_REG_CALLED, &ec->flags); - } - -@@ -1572,10 +1572,13 @@ static int ec_install_handlers(struct acpi_ec *ec, struct acpi_device *device, - - static void ec_remove_handlers(struct acpi_ec *ec) - { -+ acpi_handle scope_handle = ec == first_ec ? ACPI_ROOT_OBJECT : ec->handle; -+ - if (test_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags)) { - if (ACPI_FAILURE(acpi_remove_address_space_handler( -- ec->address_space_handler_holder, -- ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) -+ scope_handle, -+ ACPI_ADR_SPACE_EC, -+ &acpi_ec_space_handler))) - pr_err("failed to remove space handler\n"); - clear_bit(EC_FLAGS_EC_HANDLER_INSTALLED, &ec->flags); - } -@@ -1614,14 +1617,18 @@ static int acpi_ec_setup(struct acpi_ec *ec, struct acpi_device *device, bool ca - { - int ret; - -- ret = ec_install_handlers(ec, device, call_reg); -- if (ret) -- return ret; -- - /* First EC capable of handling transactions */ - if (!first_ec) - first_ec = ec; - -+ ret = ec_install_handlers(ec, device, call_reg); -+ if (ret) { -+ if (ec == first_ec) -+ first_ec = NULL; -+ -+ return ret; -+ } -+ - pr_info("EC_CMD/EC_SC=0x%lx, EC_DATA=0x%lx\n", ec->command_addr, - ec->data_addr); - -diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h -index 33cf3f38f8530..54b2be94d23dc 100644 ---- a/drivers/acpi/internal.h -+++ b/drivers/acpi/internal.h -@@ -168,7 +168,6 @@ static inline void acpi_early_processor_osc(void) {} - -------------------------------------------------------------------------- */ - struct acpi_ec { - acpi_handle handle; -- acpi_handle address_space_handler_holder; - int gpe; - int irq; - unsigned long command_addr; --- -2.53.0 - diff --git a/queue-5.15/series b/queue-5.15/series index 1a0bdc53aa..c735a70c1d 100644 --- a/queue-5.15/series +++ b/queue-5.15/series @@ -356,8 +356,6 @@ acpica-include-acpi-acpixf.h-fix-indentation.patch acpica-allow-address_space_handler-install-and-_reg-.patch acpi-ec-fix-ec-address-space-handler-unregistration.patch acpi-ec-fix-ecdt-probe-ordering-issues.patch -acpi-ec-install-address-space-handler-at-the-namespa.patch -acpi-ec-clean-up-handlers-on-probe-failure-in-acpi_e.patch hwmon-adm1177-fix-sysfs-abi-violation-and-current-un.patch sysctl-fix-uninitialized-variable-in-proc_do_large_b.patch asoc-adau1372-fix-unchecked-clk_prepare_enable-retur.patch @@ -499,7 +497,6 @@ usb-gadget-f_rndis-protect-rndis-options-with-mutex.patch usb-gadget-f_uac1_legacy-validate-control-request-size.patch io_uring-tctx-work-around-xa_store-allocation-error-issue.patch wifi-virt_wifi-remove-set_netdev_dev-to-avoid-use-after-free.patch -acpi-ec-evaluate-orphan-_reg-under-ec-device.patch lib-crypto-chacha-zeroize-permuted_state-before-it-leaves-scope.patch wifi-rt2x00usb-fix-devres-lifetime.patch xfrm_user-fix-info-leak-in-build_report.patch