HID: asus: use spinlock to safely schedule workers
authorPietro Borrello <borrello@diag.uniroma1.it>
Sun, 12 Feb 2023 19:00:03 +0000 (19:00 +0000)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 15 Feb 2023 17:20:56 +0000 (18:20 +0100)
commit4ab3a086d10eeec1424f2e8a968827a6336203df
tree748e3e98df2c98c9d24c05cc3384bd4fa2b55c93
parent315c537068a13f0b5681d33dd045a912f4bece6f
HID: asus: use spinlock to safely schedule workers

Use spinlocks to deal with workers introducing a wrapper
asus_schedule_work(), and several spinlock checks.
Otherwise, asus_kbd_backlight_set() may schedule led->work after the
structure has been freed, causing a use-after-free.

Fixes: af22a610bc38 ("HID: asus: support backlight on USB keyboards")
Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
Link: https://lore.kernel.org/r/20230125-hid-unregister-leds-v4-5-7860c5763c38@diag.uniroma1.it
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
drivers/hid/hid-asus.c