Skip to content

Commit 276822a

Browse files
hcodinalag-linaro
authored andcommitted
backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()
Lockdep detects the following issue on led-backlight removal: [ 142.315935] ------------[ cut here ]------------ [ 142.315954] WARNING: CPU: 2 PID: 292 at drivers/leds/led-core.c:455 led_sysfs_enable+0x54/0x80 ... [ 142.500725] Call trace: [ 142.503176] led_sysfs_enable+0x54/0x80 (P) [ 142.507370] led_bl_remove+0x80/0xa8 [led_bl] [ 142.511742] platform_remove+0x30/0x58 [ 142.515501] device_remove+0x54/0x90 ... Indeed, led_sysfs_enable() has to be called with the led_access lock held. Hold the lock when calling led_sysfs_disable(). Fixes: ae232e4 ("backlight: add led-backlight driver") Cc: stable@vger.kernel.org Signed-off-by: Herve Codina <herve.codina@bootlin.com> Link: https://lore.kernel.org/r/20250122091914.309533-1-herve.codina@bootlin.com Signed-off-by: Lee Jones <lee@kernel.org>
1 parent 373dacf commit 276822a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/video/backlight/led_bl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,11 @@ static void led_bl_remove(struct platform_device *pdev)
229229
backlight_device_unregister(bl);
230230

231231
led_bl_power_off(priv);
232-
for (i = 0; i < priv->nb_leds; i++)
232+
for (i = 0; i < priv->nb_leds; i++) {
233+
mutex_lock(&priv->leds[i]->led_access);
233234
led_sysfs_enable(priv->leds[i]);
235+
mutex_unlock(&priv->leds[i]->led_access);
236+
}
234237
}
235238

236239
static const struct of_device_id led_bl_of_match[] = {

0 commit comments

Comments
 (0)