From: Tristan Madani <tristmd@gmail.com>
To: "Lee, Chun-Yi" <jlee@suse.com>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: Matthew Garrett <mjg@redhat.com>, Marek Vasut <marex@denx.de>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>
Subject: [PATCH] platform/x86: acer-wmi: validate ACPI object type in acer_gsensor_event()
Date: Fri, 23 Oct 2026 19:59:25 +0000 [thread overview]
Message-ID: <20261023195925.3559887-1-tristmd@gmail.com> (raw)
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
reply other threads:[~2026-10-23 19:59 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261023195925.3559887-1-tristmd@gmail.com \
--to=tristmd@gmail.com \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jlee@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marex@denx.de \
--cc=mjg@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tristan@talencesecurity.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®