[PATCH 0/2] platform/x86: asus-wmi: Serialize WMI evaluations and drop redundant rfkill lock

Marco Scardovi posted 2 patches 6 days, 14 hours ago
drivers/platform/x86/asus-wmi.c | 67 +++++++++++----------------------
1 file changed, 23 insertions(+), 44 deletions(-)
[PATCH 0/2] platform/x86: asus-wmi: Serialize WMI evaluations and drop redundant rfkill lock
Posted by Marco Scardovi 6 days, 14 hours ago
ASUS WMI management methods share a single firmware/EC mailbox that is
not re-entrant. Concurrent evaluations from ACPI notify, sysfs, HID
callers (hid-asus, asus-armoury) and debugfs can trigger nested SMIs or
corrupt the mailbox.

This series serializes every ASUS_WMI_MGMT_GUID evaluation through a
global mutex, then drops the old per-device wmi_lock that only covered
WLAN rfkill hotplug.

The mutex is static because asus_wmi_evaluate_method() is exported and
callers outside asus-wmi have no struct asus_wmi. Fixes points at the
original shared evaluate helper rather than the later export, so stable
backports are not limited to kernels that carry that export.

Patch 1 introduces asus_wmi_evaluate_method_locked() and routes method3,
method5, method_buf and show_call through it.

Patch 2 removes the now-redundant wmi_lock and the pass-through
asus_rfkill_wlan_ops.

Link: https://github.com/OpenGamingCollective/asusctl/issues/328

Marco Scardovi (2):
  platform/x86: asus-wmi: Serialize WMI method evaluations with a mutex
  platform/x86: asus-wmi: Remove redundant per-device wmi_lock and
    duplicate rfkill ops

 drivers/platform/x86/asus-wmi.c | 67 +++++++++++----------------------
 1 file changed, 23 insertions(+), 44 deletions(-)

-- 
2.55.0
Re: [PATCH 0/2] platform/x86: asus-wmi: Serialize WMI evaluations and drop redundant rfkill lock
Posted by Armin Wolf 2 days, 3 hours ago
Am 18.09.26 um 11:14 schrieb Marco Scardovi:

> ASUS WMI management methods share a single firmware/EC mailbox that is
> not re-entrant. Concurrent evaluations from ACPI notify, sysfs, HID
> callers (hid-asus, asus-armoury) and debugfs can trigger nested SMIs or
> corrupt the mailbox.
>
> This series serializes every ASUS_WMI_MGMT_GUID evaluation through a
> global mutex, then drops the old per-device wmi_lock that only covered
> WLAN rfkill hotplug.
>
> The mutex is static because asus_wmi_evaluate_method() is exported and
> callers outside asus-wmi have no struct asus_wmi. Fixes points at the
> original shared evaluate helper rather than the later export, so stable
> backports are not limited to kernels that carry that export.
>
> Patch 1 introduces asus_wmi_evaluate_method_locked() and routes method3,
> method5, method_buf and show_call through it.
>
> Patch 2 removes the now-redundant wmi_lock and the pass-through
> asus_rfkill_wlan_ops.

Reviewed-by: Armin Wolf <W_Armin@gmx.de>

>
> Link: https://github.com/OpenGamingCollective/asusctl/issues/328
>
> Marco Scardovi (2):
>    platform/x86: asus-wmi: Serialize WMI method evaluations with a mutex
>    platform/x86: asus-wmi: Remove redundant per-device wmi_lock and
>      duplicate rfkill ops
>
>   drivers/platform/x86/asus-wmi.c | 67 +++++++++++----------------------
>   1 file changed, 23 insertions(+), 44 deletions(-)
>