From: Bartu Alev <bartualev@gmail.com>
To: "Corentin Chary" <corentin.chary@gmail.com>,
"Luke D. Jones" <luke@ljones.dev>,
"Denis Benato" <denis.benato@linux.dev>,
"Hans de Goede" <hansg@kernel.org>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, Bartu Alev <bartualev@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 0/3] platform/asus: asus-wmi: harden asus_wmi_evaluate_method_buf()
Date: Wed, 02 Dec 2026 02:31:41 +0300 [thread overview]
Message-ID: <20261202-asus-wmi-eval-buf-v1-0-640c12d437dc@gmail.com> (raw)
During review of the TUF keyboard RGB readback series [1] (and earlier
noted in the fan floor series [2]), two defects and follow-up cleanup
opportunities were identified in asus_wmi_evaluate_method_buf():
1. It dereferences output.pointer in switch (obj->type) without checking
for NULL, even though acpi_evaluate_object() returns AE_OK with
output.pointer == NULL when a method returns no object.
2. In the ACPI_TYPE_INTEGER case, it assigns the u32 firmware value
directly to signed int err. Values with bit 31 set alias negative
errnos (e.g., 0xffffffff becomes -EPERM), while positive integers
(such as ASUS_WMI_DSTS_UNKNOWN_BIT, 0x2, seen on ASUS hardware)
can propagate to sysfs/kernfs via fan_curve_enable_store() as a
positive byte count instead of an error.
This series separates those fixes from the TUF RGB readback feature and
splits the changes into three logical patches:
1. Fix the NULL dereference and integer decoding in plain C, using
manual kfree() and top-of-block declarations without touching the
asus_wmi_evaluate_method_locked() call site. Keeping this patch
free of cleanup.h (__free) dependencies allows it to apply cleanly
to active -stable trees down to 6.1 LTS.
2. Convert the helper to __free(kfree) and take ownership of
output.pointer immediately after asus_wmi_evaluate_method_locked().
This removes the out_free goto and also frees return_buffer->pointer
if ACPICA fails in acpi_ut_copy_iobject_to_eobject() after
acpi_ut_initialize_buffer() has already allocated it.
3. Add kernel-doc for asus_wmi_evaluate_method_buf(), documenting its
parameters, partial-copy behavior when replies are shorter than
@size, and all error returns as a ReST list.
[1] https://lore.kernel.org/all/20261029-asus-tuf-rgb-v4-v4-0-0d3b877d2c30@gmail.com/
[2] https://lore.kernel.org/all/20261101-asus-fan-floors-v4-v1-0-b8d1c31a99a9@gmail.com/
Signed-off-by: Bartu Alev <bartualev@gmail.com>
---
Bartu Alev (3):
platform/asus: asus-wmi: Fix NULL deref and integer handling in asus_wmi_evaluate_method_buf()
platform/asus: asus-wmi: Use __free(kfree) in asus_wmi_evaluate_method_buf()
platform/asus: asus-wmi: Document asus_wmi_evaluate_method_buf()
drivers/platform/asus/asus-wmi.c | 63 +++++++++++++++++++++++++++++++---------
1 file changed, 49 insertions(+), 14 deletions(-)
---
base-commit: f09fec5a32d43dd3f9e32d531d05422a9f6191d0
change-id: 20261202-asus-wmi-eval-buf-d97eb912c6d2
Best regards,
--
Bartu Alev <bartualev@gmail.com>
next reply other threads:[~2026-12-01 23:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 23:31 Bartu Alev [this message]
2026-12-01 23:31 ` [PATCH 1/3] platform/asus: asus-wmi: Fix NULL deref and integer handling in asus_wmi_evaluate_method_buf() Bartu Alev
2026-12-01 23:31 ` [PATCH 2/3] platform/asus: asus-wmi: Use __free(kfree) " Bartu Alev
2026-12-01 23:31 ` [PATCH 3/3] platform/asus: asus-wmi: Document asus_wmi_evaluate_method_buf() Bartu Alev
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=20261202-asus-wmi-eval-buf-v1-0-640c12d437dc@gmail.com \
--to=bartualev@gmail.com \
--cc=corentin.chary@gmail.com \
--cc=denis.benato@linux.dev \
--cc=hansg@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=platform-driver-x86@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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®