]> www.infradead.org Git - users/jedix/linux-maple.git/commit
leds: triggers: Flush pending brightness before activating trigger
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 13 Jun 2024 15:24:51 +0000 (17:24 +0200)
committerLee Jones <lee@kernel.org>
Wed, 26 Jun 2024 15:56:07 +0000 (16:56 +0100)
commitab477b766edd3bfb6321a6e3df4c790612613fae
treec03855177ca31ec1d0e491c0448173035d636b9e
parent25458b2a4070c339d11af78dbecff3e845e6ad04
leds: triggers: Flush pending brightness before activating trigger

The race fixed in timer_trig_activate() between a blocking
set_brightness() call and trigger->activate() can affect any trigger.
So move the call to flush_work() into led_trigger_set() where it can
avoid the race for all triggers.

Fixes: 0db37915d912 ("leds: avoid races with workqueue")
Fixes: 8c0f693c6eff ("leds: avoid flush_work in atomic context")
Cc: stable@vger.kernel.org
Tested-by: Dustin L. Howett <dustin@howett.net>
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20240613-led-trigger-flush-v2-1-f4f970799d77@weissschuh.net
Signed-off-by: Lee Jones <lee@kernel.org>
drivers/leds/led-triggers.c
drivers/leds/trigger/ledtrig-timer.c