Skip to contentSkip to conversation

ACPICA: Refuse to evaluate a method if arguments are missing

PATCH In review Rafael J. Wysocki 2 participants 2 messages Jun 18, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPICA: Refuse to evaluate a method if arguments are missing

From: Rafael J. Wysocki <[email protected]>

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.

---

This is an exception as it fixes a kernel crash on multiple platforms affected by the defective platform firmware update.

I will take care of submitting an equivalent change to upstream ACPICA later.

---
 drivers/acpi/acpica/dsmethod.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/acpi/acpica/dsmethod.c +7 -0
@@ -483,6 +483,13 @@
 		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 =
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi,

Quoted 6 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

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.

Quoted 8 lines

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.

Thanks, patch looks good to me and I've also tested it:

Regards,

Hans

Quoted 31 lines

---

This is an exception as it fixes a kernel crash on multiple platforms affected by the defective platform firmware update.

I will take care of submitting an equivalent change to upstream ACPICA later.

---
 drivers/acpi/acpica/dsmethod.c |    7 +++++++
 1 file changed, 7 insertions(+)
drivers/acpi/acpica/dsmethod.c +7 -0
@@ -483,6 +483,13 @@
 		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 =