]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hwmon: (asus_atk0110) Check package count before accessing element
authorHyeongJun An <sammiee5311@gmail.com>
Fri, 19 Jun 2026 12:27:46 +0000 (21:27 +0900)
committerGuenter Roeck <linux@roeck-us.net>
Mon, 29 Jun 2026 15:51:59 +0000 (08:51 -0700)
atk_ec_present() walks the management group package returned by the GGRP
ACPI method and, for each sub-package, reads its first element:

id = &obj->package.elements[0];
if (id->type != ACPI_TYPE_INTEGER)

without checking that the sub-package is non-empty.  ACPICA allocates the
element array with exactly package.count entries, so for a sub-package
with a zero count this reads past the allocation.

The sibling function atk_debugfs_ggrp_open() performs the same access but
skips empty packages with a package.count check first.  Add the same
check to atk_ec_present() so a malformed firmware package cannot trigger
an out-of-bounds read.

Fixes: 9e6eba610c2e ("hwmon: (asus_atk0110) Enable the EC")
Cc: stable@vger.kernel.org
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: HyeongJun An <sammiee5311@gmail.com>
Link: https://lore.kernel.org/r/20260619122746.721981-1-sammiee5311@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/asus_atk0110.c

index 109318b0434d99b6d410a63c4430fedc173f0a9f..92afb64c09df8d64ef69f9e947ebaeac5cd58ff5 100644 (file)
@@ -1037,6 +1037,9 @@ static int atk_ec_present(struct atk_data *data)
                if (obj->type != ACPI_TYPE_PACKAGE)
                        continue;
 
+               if (!obj->package.count)
+                       continue;
+
                id = &obj->package.elements[0];
                if (id->type != ACPI_TYPE_INTEGER)
                        continue;