platform/x86: acer-wmi: reject missing gaming WMI results
Subsystems (2)
PATCH 1/1 platform/x86: acer-wmi: reject missing gaming WMI results
WMI_gaming_execute_u32_u64() returns success when firmware supplies no output object, leaving the caller output untouched. Gaming getters then inspect an uninitialized result value.
Return -ENOMSG for a missing object and -EINVAL for a missing output pointer, matching the existing malformed-result handling.
--- drivers/platform/x86/acer-wmi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/acer-wmi.c +5 -1
@@ -1581,7 +1581,11 @@ static int WMI_gaming_execute_u32_u64(u32 method_id, u32 in, u64 *out)return -EIO ; obj = result.pointer; -if (obj && out) { +if (!obj) { + ret = -ENOMSG ; + }else if (!out) { + ret = -EINVAL ; + }else {switch (obj->type) {case ACPI_TYPE_INTEGER : *out = obj->integer.value;
Signature · 1 line
2.54.0
Am 30.06.26 um 12:50 schrieb Yousef Alhouseen:
Quoted 6 lines
WMI_gaming_execute_u32_u64()returns success when firmware supplies no output object, leaving the caller output untouched. Gaming getters then inspect an uninitialized result value.Return
-ENOMSGfor a missing object and-EINVALfor a missing output pointer, matching the existing malformed-result handling.
Good catch, but i suspect that the original intention for checking "out" was to enable callers to ignore any output values by passing "out" as NULL.
Please only return an error if obj is NULL _and_ out is not NULL.
Thanks,
Armin Wolf
Quoted 22 lines
Signed-off-by Yousef Alhouseen <[email protected]>--- drivers/platform/x86/acer-wmi.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/platform/x86/acer-wmi.c +5
-1@@ -1581,7 +1581,11 @@ static int WMI_gaming_execute_u32_u64(u32 method_id, u32 in, u64 *out)return -EIO ; obj = result.pointer; -if (obj && out) { +if (!obj) { + ret = -ENOMSG ; + }else if (!out) { + ret = -EINVAL ; + }else {switch (obj->type) {case ACPI_TYPE_INTEGER : *out = obj->integer.value;
Thanks, Armin. That interpretation makes sense. I’ll preserve NULL as the output-ignore case and only reject a missing object when the caller supplied an output pointer in v2.
Quoted 39 lines · Armin Wolf
Am 30.06.26 um 12:50 schrieb Yousef Alhouseen:
Quoted 6 lines
WMI_gaming_execute_u32_u64()returns success when firmware supplies no output object, leaving the caller output untouched. Gaming getters then inspect an uninitialized result value.Return
-ENOMSGfor a missing object and-EINVALfor a missing output pointer, matching the existing malformed-result handling.Good catch, but i suspect that the original intention for checking "out" was to enable callers to ignore any output values by passing "out" as NULL.
Please only return an error if obj is NULL _and_ out is not NULL.
Thanks,
Armin WolfQuoted 22 lines
Signed-off-by Yousef Alhouseen <[email protected]>---
drivers/platform/x86/acer-wmi.c| 6 +++++-1 file changed, 5 insertions(+), 1 deletion(-)drivers/platform/x86/acer-wmi.c +5
-1@@ -1581,7 +1581,11 @@ static int WMI_gaming_execute_u32_u64(u32 method_id, u32 in, u64 *out)return -EIO ; obj = result.pointer; -if (obj && out) { +if (!obj) { + ret = -ENOMSG ; + }else if (!out) { + ret = -EINVAL ; + }else {switch (obj->type) {case
ACPI_TYPE_INTEGER:
*out =obj->integer.value;
PATCH v2 1/1 platform/x86: acer-wmi: reject missing gaming WMI results
In reply to Yousef AlhouseenWMI_gaming_execute_u32_u64() returns success when firmware supplies no output object, leaving the caller output untouched. Gaming getters then inspect an uninitialized result value.
When the caller requests an output value, return -ENOMSG if firmware supplies no object. Preserve a NULL output pointer as the supported way for callers to ignore the result.
---
Changes in v2:
- Preserve NULL as the supported output-ignore case.
- Only reject a missing firmware object when output was requested.
drivers/platform/x86/acer-wmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/acer-wmi.c +3 -1
@@ -1581,7 +1581,9 @@ static int WMI_gaming_execute_u32_u64(u32 method_id, u32 in, u64 *out)return -EIO ; obj = result.pointer; -if (obj && out) { +if (!obj && out) { + ret = -ENOMSG ; + }else if (obj && out) {switch (obj->type) {case ACPI_TYPE_INTEGER : *out = obj->integer.value;
Signature · 1 line
2.55.0
Ilpo Järvinen
maintainerQuoted 9 lines · Yousef Alhouseen
WMI_gaming_execute_u32_u64()returns success when firmware supplies no output object, leaving the caller output untouched. Gaming getters then inspect an uninitialized result value.When the caller requests an output value, return
-ENOMSGif firmware supplies no object. Preserve a NULL output pointer as the supported way for callers to ignore the result.Signed-off-by Yousef Alhouseen <[email protected]>
Should this have a Fixes tag?
Quoted 24 lines
---
Changes in v2:
- Preserve NULL as the supported output-ignore case.
- Only reject a missing firmware object when output was requested.drivers/platform/x86/acer-wmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/platform/x86/acer-wmi.c +3
-1@@ -1581,7 +1581,9 @@ static int WMI_gaming_execute_u32_u64(u32 method_id, u32 in, u64 *out)return -EIO ; obj = result.pointer; -if (obj && out) { +if (!obj && out) { + ret = -ENOMSG ; + }else if (obj && out) {switch (obj->type) {case ACPI_TYPE_INTEGER : *out = obj->integer.value;
Signature · 1 line
i.
PATCH v3 1/1 platform/x86: acer-wmi: reject missing gaming WMI results
In reply to Yousef AlhouseenWMI_gaming_execute_u32_u64() returns success when firmware supplies no output object, leaving the caller output untouched. Gaming getters then inspect an uninitialized result value.
When the caller requests an output value, return -ENOMSG if firmware supplies no object. Preserve a NULL output pointer as the supported way for callers to ignore the result.
---
Changes in v3:
- Add the Fixes tag requested by Ilpo Järvinen.
Changes in v2:
- Preserve NULL as the supported output-ignore case.
- Only reject a missing firmware object when output was requested.
drivers/platform/x86/acer-wmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/platform/x86/acer-wmi.c +3 -1
@@ -1581,7 +1581,9 @@ static int WMI_gaming_execute_u32_u64(u32 method_id, u32 in, u64 *out)return -EIO ; obj = result.pointer; -if (obj && out) { +if (!obj && out) { + ret = -ENOMSG ; + }else if (obj && out) {switch (obj->type) {case ACPI_TYPE_INTEGER : *out = obj->integer.value;
Signature · 1 line
2.55.0
Ilpo Järvinen
maintainerQuoted 9 lines · Yousef Alhouseen
WMI_gaming_execute_u32_u64()returns success when firmware supplies no output object, leaving the caller output untouched. Gaming getters then inspect an uninitialized result value.When the caller requests an output value, return
-ENOMSGif firmware supplies no object. Preserve a NULL output pointer as the supported way for callers to ignore the result.[...]
Thank you for your contribution, it has been applied to my local review-ilpo-next branch. Note it will show up in the public platform-drivers-x86/review-ilpo-next branch only once I've pushed my local branch there, which might take a while.
FYI [if applicable to your patch], as per Linus' policy change, also fixes are mostly routed through for-next unless the fix is for a commit introduced in the most recent cycle or is clearly a regression fix.
The list of commits applied:
[1/1] platform/x86: acer-wmi: reject missing gaming WMI results
commit: caf8342512c3056005f475d350eeca089c3c6623
--
i.