platform/x86: asus-wmi: Fix racy registrations
authorTakashi Iwai <tiwai@suse.de>
Wed, 27 Aug 2025 05:24:33 +0000 (07:24 +0200)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Thu, 28 Aug 2025 15:46:31 +0000 (18:46 +0300)
commit5549202b9c02c2ecbc8634768a3da8d9e82d548d
treef26040b8de714a1ea9eefe0441cec0d890e58a7c
parentc96f86217bb28e019403bb8f59eacd8ad5a7ad1a
platform/x86: asus-wmi: Fix racy registrations

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