]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ACPICA: Fix NULL pointer dereference in acpi_ns_custom_package()
authorWeiming Shi <bestswngs@gmail.com>
Wed, 27 May 2026 18:05:42 +0000 (20:05 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 27 May 2026 18:18:46 +0000 (20:18 +0200)
acpi_ns_custom_package() unconditionally dereferences the first element
of the package to read the _BIX version number, without checking for
NULL:

    if ((*Elements)->Common.Type != ACPI_TYPE_INTEGER)

When firmware returns a _BIX package whose first element is an
unresolvable reference, ACPICA evaluates that entry to NULL.
acpi_ns_remove_null_elements() does not strip NULL entries for
ACPI_PTYPE_CUSTOM packages (fixed-position format would break if
elements were shifted), so acpi_ns_custom_package() sees the NULL
and causes a crash.

Add a NULL check for the first element (version field) before
dereferencing it. The caller then receives AE_AML_OPERAND_TYPE
instead of crashing.

Link: https://github.com/acpica/acpica/commit/f3f111b9013b
Reported-by: Xiang Mei <xmei5@asu.edu>
Reported-by: Weiming Shi <bestswngs@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/5674388.Sb9uPGUboI@rafael.j.wysocki
drivers/acpi/acpica/nsprepkg.c

index ca137ce5674fb876d62f97850e5c8bfbf320159d..c32770570120ab28b308274ddf028eb7b676b091 100644 (file)
@@ -631,6 +631,13 @@ acpi_ns_custom_package(struct acpi_evaluate_info *info,
 
        /* Get version number, must be Integer */
 
+       if (!(*elements)) {
+               ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
+                                     info->node_flags,
+                                     "Return Package has a NULL version element"));
+               return_ACPI_STATUS(AE_AML_OPERAND_TYPE);
+       }
+
        if ((*elements)->common.type != ACPI_TYPE_INTEGER) {
                ACPI_WARN_PREDEFINED((AE_INFO, info->full_pathname,
                                      info->node_flags,