* [PATCH v2] platform/x86: wmi: Make input buffer madatory when evaulating methods
@ 2024-02-12 18:50 Armin Wolf
2024-02-13 11:40 ` Ilpo Järvinen
0 siblings, 1 reply; 2+ messages in thread
From: Armin Wolf @ 2024-02-12 18:50 UTC (permalink / raw)
To: hdegoede, ilpo.jarvinen
Cc: sathyanarayanan.kuppuswamy, platform-driver-x86, linux-kernel
The ACPI-WMI specification declares in the section "ACPI Control Method
Naming Conventions and Functionality for Windows 2000 Instrumentation"
that a WMxx control method takes 3 arguments: instance, method id and
argument buffer.
This is also the case even when the underlying WMI method does not
have any input arguments.
So if a WMI driver evaluates a WMI method without passing an input
buffer, ACPICA will log a warning complaining that the third argument
is missing.
Prevent this by checking that a input buffer was passed, and return
an error if this was not the case.
Tested on a Asus PRIME B650-Plus.
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
---
Changes since v1:
- add section reference
- add Reviewed-by
---
drivers/platform/x86/wmi.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c
index 63906fdd0abf..f9e23d491dd9 100644
--- a/drivers/platform/x86/wmi.c
+++ b/drivers/platform/x86/wmi.c
@@ -296,7 +296,7 @@ EXPORT_SYMBOL_GPL(wmidev_instance_count);
* @guid_string: 36 char string of the form fa50ff2b-f2e8-45de-83fa-65417f2f49ba
* @instance: Instance index
* @method_id: Method ID to call
- * @in: Buffer containing input for the method call
+ * @in: Mandatory buffer containing input for the method call
* @out: Empty buffer to return the method results
*
* Call an ACPI-WMI method, the caller must free @out.
@@ -326,7 +326,7 @@ EXPORT_SYMBOL_GPL(wmi_evaluate_method);
* @wdev: A wmi bus device from a driver
* @instance: Instance index
* @method_id: Method ID to call
- * @in: Buffer containing input for the method call
+ * @in: Mandatory buffer containing input for the method call
* @out: Empty buffer to return the method results
*
* Call an ACPI-WMI method, the caller must free @out.
@@ -347,26 +347,25 @@ acpi_status wmidev_evaluate_method(struct wmi_device *wdev, u8 instance, u32 met
block = &wblock->gblock;
handle = wblock->acpi_device->handle;
+ if (!in)
+ return AE_BAD_DATA;
+
if (!(block->flags & ACPI_WMI_METHOD))
return AE_BAD_DATA;
if (block->instance_count <= instance)
return AE_BAD_PARAMETER;
- input.count = 2;
+ input.count = 3;
input.pointer = params;
+
params[0].type = ACPI_TYPE_INTEGER;
params[0].integer.value = instance;
params[1].type = ACPI_TYPE_INTEGER;
params[1].integer.value = method_id;
-
- if (in) {
- input.count = 3;
-
- params[2].type = get_param_acpi_type(wblock);
- params[2].buffer.length = in->length;
- params[2].buffer.pointer = in->pointer;
- }
+ params[2].type = get_param_acpi_type(wblock);
+ params[2].buffer.length = in->length;
+ params[2].buffer.pointer = in->pointer;
get_acpi_method_name(wblock, 'M', method);
--
2.39.2
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH v2] platform/x86: wmi: Make input buffer madatory when evaulating methods
2024-02-12 18:50 [PATCH v2] platform/x86: wmi: Make input buffer madatory when evaulating methods Armin Wolf
@ 2024-02-13 11:40 ` Ilpo Järvinen
0 siblings, 0 replies; 2+ messages in thread
From: Ilpo Järvinen @ 2024-02-13 11:40 UTC (permalink / raw)
To: hdegoede, Armin Wolf
Cc: sathyanarayanan.kuppuswamy, platform-driver-x86, linux-kernel
On Mon, 12 Feb 2024 19:50:16 +0100, Armin Wolf wrote:
> The ACPI-WMI specification declares in the section "ACPI Control Method
> Naming Conventions and Functionality for Windows 2000 Instrumentation"
> that a WMxx control method takes 3 arguments: instance, method id and
> argument buffer.
> This is also the case even when the underlying WMI method does not
> have any input arguments.
>
> [...]
Thank you for your contribution, it has been applied to my local
review-ilpo branch. Note it will show up in the public
platform-drivers-x86/review-ilpo branch only once I've pushed my
local branch there, which might take a while.
The list of commits applied:
[1/1] platform/x86: wmi: Make input buffer madatory when evaulating methods
commit: 5b559e8ab01c8d7a92478f8143ba844161292203
--
i.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-13 11:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12 18:50 [PATCH v2] platform/x86: wmi: Make input buffer madatory when evaulating methods Armin Wolf
2024-02-13 11:40 ` Ilpo Järvinen
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®