* [PATCH] platform/x86: acer-wmi: validate ACPI object type in acer_gsensor_event()
@ 2026-10-23 19:59 Tristan Madani
0 siblings, 0 replies; only message in thread
From: Tristan Madani @ 2026-10-23 19:59 UTC (permalink / raw)
To: Lee, Chun-Yi, Hans de Goede, Ilpo Järvinen
Cc: Matthew Garrett, Marek Vasut, platform-driver-x86, linux-kernel,
stable, Tristan Madani
From: Tristan Madani <tristan@talencesecurity.com>
acer_gsensor_event() accesses the ACPI evaluation result as a package
without first verifying the object type. If the firmware returns a
non-package type, the code reads package.count and package.elements
from the wrong union member, which can cause a NULL pointer
dereference or read from an invalid address.
Add a type check for ACPI_TYPE_PACKAGE before accessing the package
fields, and validate that each element is ACPI_TYPE_INTEGER before
reading integer.value.
Fixes: 1eb3fe1d3b6b ("ACER: Add support for accelerometer sensor")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
drivers/platform/x86/acer-wmi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 61ae622c93d94..72b44f02a992f 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -2043,7 +2043,12 @@ static int acer_gsensor_event(void)
if (ACPI_FAILURE(status))
return -1;
- if (out_obj->package.count != 4)
+ if (out_obj->type != ACPI_TYPE_PACKAGE || out_obj->package.count != 4)
+ return -1;
+
+ if (out_obj->package.elements[0].type != ACPI_TYPE_INTEGER ||
+ out_obj->package.elements[1].type != ACPI_TYPE_INTEGER ||
+ out_obj->package.elements[2].type != ACPI_TYPE_INTEGER)
return -1;
input_report_abs(acer_wmi_accel_dev, ABS_X,
--
2.47.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-23 19:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-23 19:59 [PATCH] platform/x86: acer-wmi: validate ACPI object type in acer_gsensor_event() Tristan Madani
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®