]> git.baikalelectronics.ru Git - kernel.git/commit
HID: bigben: use spinlock to safely schedule workers
authorPietro Borrello <borrello@diag.uniroma1.it>
Sun, 12 Feb 2023 19:00:01 +0000 (19:00 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 11 Mar 2023 15:43:48 +0000 (16:43 +0100)
commit87d0398fc3e781487f1359236f489bdf6da923d3
tree34b154be83b29dcde4dd57c0d9fce91273e06dea
parent7308a00f7865c6953ac2c04d5f1c361078441b69
HID: bigben: use spinlock to safely schedule workers

[ Upstream commit 76ca8da989c7d97a7f76c75d475fe95a584439d7 ]

Use spinlocks to deal with workers introducing a wrapper
bigben_schedule_work(), and several spinlock checks.
Otherwise, bigben_set_led() may schedule bigben->worker after the
structure has been freed, causing a use-after-free.

Fixes: 24c463dcd9f5 ("HID: hid-bigbenff: fix race condition for scheduled work during removal")
Signed-off-by: Pietro Borrello <borrello@diag.uniroma1.it>
Link: https://lore.kernel.org/r/20230125-hid-unregister-leds-v4-3-7860c5763c38@diag.uniroma1.it
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-bigbenff.c