platform/x86: xiaomi-wmi: Fix race condition when reporting key events
authorArmin Wolf <W_Armin@gmx.de>
Tue, 2 Apr 2024 14:30:57 +0000 (16:30 +0200)
committerHans de Goede <hdegoede@redhat.com>
Mon, 8 Apr 2024 15:45:35 +0000 (17:45 +0200)
commit290680c2da8061e410bcaec4b21584ed951479af
treec2c94277de837f712d5c2bbe2aaf38f1f728f5da
parentc347fd4fe84ab831db8b4361977437b587526165
platform/x86: xiaomi-wmi: Fix race condition when reporting key events

Multiple WMI events can be received concurrently, so multiple instances
of xiaomi_wmi_notify() can be active at the same time. Since the input
device is shared between those handlers, the key input sequence can be
disturbed.

Fix this by protecting the key input sequence with a mutex.

Compile-tested only.

Fixes: edb73f4f0247 ("platform/x86: wmi: add Xiaomi WMI key driver")
Signed-off-by: Armin Wolf <W_Armin@gmx.de>
Link: https://lore.kernel.org/r/20240402143059.8456-2-W_Armin@gmx.de
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
drivers/platform/x86/xiaomi-wmi.c