Skip to contentSkip to conversation

platform/wmi: Fix unchecked min_size in wmidev_invoke_method()

PATCH In review Kurt Borja 3 participants 3 messages Apr 29 – Apr 30

Subsystems (2)
lore
Share & tools
lore

Kurt Borja

author
#0 lore raw

PATCH 1/1 platform/wmi: Fix unchecked min_size in wmidev_invoke_method()

After calling wmidev_evaluate_method(), if the ACPI core does not return an out object, then wmidev_invoke_method() bypasses the min_size check and returns 0. Add a check for min_size if there is not an out object.

Fixes 1aeded2f55f0 ("platform/wmi: Extend wmidev_query_block() to reject undersized data")
---
 drivers/platform/wmi/core.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/platform/wmi/core.c +3 -0
index 7aa40dab6145..5a2ffcbab6af 100644
@@ -411,6 +411,9 @@ int wmidev_invoke_method(struct wmi_device *wdev, u8 instance, u32 method_id,
 
 	obj = aout.pointer;
 	if (!obj) {
+		if (min_size != 0)
+			return -ENOMSG;
+
 		out->length = 0;
 		out->data = ZERO_SIZE_PTR;
 

---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260429-invoke-fix-44f026f90c56

Signature · 2 lines
Thanks, 
 ~ Kurt
maintainer Reviewed-by on v1 1/1
#1 lore raw

Am 29.04.26 um 15:20 schrieb Kurt Borja:

Quoted 3 lines

After calling wmidev_evaluate_method(), if the ACPI core does not return an out object, then wmidev_invoke_method() bypasses the min_size check and returns 0. Add a check for min_size if there is not an out object.

Quoted 26 lines
Fixes 1aeded2f55f0 ("platform/wmi: Extend wmidev_query_block() to reject undersized data")
---
  drivers/platform/wmi/core.c | 3 +++
  1 file changed, 3 insertions(+)
drivers/platform/wmi/core.c +3 -1
index 7aa40dab6145..5a2ffcbab6af 100644
@@ -411,6 +411,9 @@ int wmidev_invoke_method(struct wmi_device *wdev, u8 instance, u32 method_id,
 
  	obj = aout.pointer;
  	if (!obj) {
+		if (min_size != 0)
+			return -ENOMSG;
+
  		out->length = 0;
  		out->data = ZERO_SIZE_PTR;
 
 
---

base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260429-invoke-fix-44f026f90c56

maintainer
#2 lore raw
In reply to Kurt Borja
Quoted 5 lines · Kurt Borja

After calling wmidev_evaluate_method(), if the ACPI core does not return an out object, then wmidev_invoke_method() bypasses the min_size check and returns 0. Add a check for min_size if there is not an out object.

Thank you for your contribution, it has been applied to my local review-ilpo-fixes branch. Note it will show up in the public platform-drivers-x86/review-ilpo-fixes branch only once I've pushed my local branch there, which might take a while.

The list of commits applied:
[1/1] platform/wmi: Fix unchecked min_size in wmidev_invoke_method()

      commit: d3b7a868f1aeb6a43de880a3709ef3a0341f2c2a

--
i.