]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ACPICA: Refuse to evaluate a method if arguments are missing
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 18 Jun 2025 12:17:45 +0000 (14:17 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 18 Jun 2025 19:12:13 +0000 (21:12 +0200)
As reported in [1], a platform firmware update that increased the number
of method parameters and forgot to update a least one of its callers,
caused ACPICA to crash due to use-after-free.

Since this a result of a clear AML issue that arguably cannot be fixed
up by the interpreter (it cannot produce missing data out of thin air),
address it by making ACPICA refuse to evaluate a method if the caller
attempts to pass fewer arguments than expected to it.

Closes: https://github.com/acpica/acpica/issues/1027 [1]
Reported-by: Peter Williams <peter@newton.cx>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Hans de Goede <hansg@kernel.org>
Tested-by: Hans de Goede <hansg@kernel.org> # Dell XPS 9640 with BIOS 1.12.0
Link: https://patch.msgid.link/5909446.DvuYhMxLoT@rjwysocki.net
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/acpica/dsmethod.c

index c8f37f4e66261ccb5b4ff00d69d7539296e324f8..fef6fb29ece4d6eb0062c7df11233f519cd387d9 100644 (file)
@@ -483,6 +483,13 @@ acpi_ds_call_control_method(struct acpi_thread_state *thread,
                return_ACPI_STATUS(AE_NULL_OBJECT);
        }
 
+       if (this_walk_state->num_operands < obj_desc->method.param_count) {
+               ACPI_ERROR((AE_INFO, "Missing argument for method [%4.4s]",
+                           acpi_ut_get_node_name(method_node)));
+
+               return_ACPI_STATUS(AE_AML_UNINITIALIZED_ARG);
+       }
+
        /* Init for new method, possibly wait on method mutex */
 
        status =