Bug#1110703:
Control: tags -1 + moreinfo
Hi Attilio
On Sat, Sep 06, 2025 at 07:42:29PM +0000, attilio giuseppe carolillo wrote:
> I found a bug opened by another user with an Asus MB, with my same issue (it is related to the asus_wmi module):
>
> https://bugzilla.kernel.org/show_bug.cgi?id=220473
>
> https://bugzilla.opensuse.org/show_bug.cgi?id=1246924#c14
>
> This is the solutive comment:
> https://bugzilla.opensuse.org/show_bug.cgi?id=1246924#c21
>
> and the patch:
> https://bugzilla.opensuse.org/attachment.cgi?id=885249&action=diff
>
> The same user suggests a workaround:
>
> "......blacklisted the 'asus_wmi' and the 'asus_nb_wmi' modules through the '/etc/modprobe.d/blacklist.conf'...."
>
> ...the workaround works!!!!!! until the kernel will be patched.
>
> I think/hope this issue is fixed with kernel >6.16.3.
Can you please try the attached patch with the procedure described in
https://kernel-team.pages.debian.net/kernel-handbook/ch-common-tasks.html#id-1.6.6.4
and report back if that fixes your problem?
Regards,
Salvatore
>From 5549202b9c02c2ecbc8634768a3da8d9e82d548d Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 27 Aug 2025 07:24:33 +0200
Subject: [PATCH] platform/x86: asus-wmi: Fix racy registrations
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
asus_wmi_register_driver() may be called from multiple drivers
concurrently, which can lead to the racy list operations, eventually
corrupting the memory and hitting Oops on some ASUS machines.
Also, the error handling is missing, and it forgot to unregister ACPI
lps0 dev ops in the error case.
This patch covers those issues by introducing a simple mutex at
acpi_wmi_register_driver() & *_unregister_driver, and adding the
proper call of asus_s2idle_check_unregister() in the error path.
Fixes: feea7bd6b02d ("platform/x86: asus-wmi: Refactor Ally suspend/resume")
Link: https://bugzilla.suse.com/show_bug.cgi?id=1246924
Link: https://lore.kernel.org/07815053-0e31-4e8e-8049-b652c929323b@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20250827052441.23382-1-tiwai@suse.de
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/platform/x86/asus-wmi.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index f7191fdded14..e72a2b5d158e 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -5088,16 +5088,22 @@ static int asus_wmi_probe(struct platform_device *pdev)
asus_s2idle_check_register();
- return asus_wmi_add(pdev);
+ ret = asus_wmi_add(pdev);
+ if (ret)
+ asus_s2idle_check_unregister();
+
+ return ret;
}
static bool used;
+static DEFINE_MUTEX(register_mutex);
int __init_or_module asus_wmi_register_driver(struct asus_wmi_driver *driver)
{
struct platform_driver *platform_driver;
struct platform_device *platform_device;
+ guard(mutex)(®ister_mutex);
if (used)
return -EBUSY;
@@ -5120,6 +5126,7 @@ EXPORT_SYMBOL_GPL(asus_wmi_register_driver);
void asus_wmi_unregister_driver(struct asus_wmi_driver *driver)
{
+ guard(mutex)(®ister_mutex);
asus_s2idle_check_unregister();
platform_device_unregister(driver->platform_device);
--
2.51.0
Reply to:
- References:
- Bug#1110703:
- From: attilio giuseppe carolillo <ing.attilio.carolillo@live.com>