* [PATCH] backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()
@ 2025-01-22 9:19 Herve Codina
2025-02-07 13:30 ` Herve Codina
2025-02-11 14:12 ` (subset) " Lee Jones
0 siblings, 2 replies; 3+ messages in thread
From: Herve Codina @ 2025-01-22 9:19 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller,
Tony Lindgren, Pavel Machek, Tomi Valkeinen, Jean-Jacques Hiblot
Cc: Daniel Thompson, dri-devel, linux-fbdev, linux-kernel,
Luca Ceresoli, Thomas Petazzoni, Herve Codina, stable
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: ae232e45acf9 ("backlight: add led-backlight driver")
Cc: stable@vger.kernel.org
Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
drivers/video/backlight/led_bl.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c
index ae34d1ecbfbe..d2db157b2c29 100644
--- a/drivers/video/backlight/led_bl.c
+++ b/drivers/video/backlight/led_bl.c
@@ -229,8 +229,11 @@ static void led_bl_remove(struct platform_device *pdev)
backlight_device_unregister(bl);
led_bl_power_off(priv);
- for (i = 0; i < priv->nb_leds; i++)
+ for (i = 0; i < priv->nb_leds; i++) {
+ mutex_lock(&priv->leds[i]->led_access);
led_sysfs_enable(priv->leds[i]);
+ mutex_unlock(&priv->leds[i]->led_access);
+ }
}
static const struct of_device_id led_bl_of_match[] = {
--
2.47.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()
2025-01-22 9:19 [PATCH] backlight: led_bl: Hold led_access lock when calling led_sysfs_disable() Herve Codina
@ 2025-02-07 13:30 ` Herve Codina
2025-02-11 14:12 ` (subset) " Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Herve Codina @ 2025-02-07 13:30 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller,
Tony Lindgren, Pavel Machek, Tomi Valkeinen, Jean-Jacques Hiblot
Cc: Daniel Thompson, dri-devel, linux-fbdev, linux-kernel,
Luca Ceresoli, Thomas Petazzoni, stable
Hi Lee, Daniel, Jingoo,
On Wed, 22 Jan 2025 10:19:14 +0100
Herve Codina <herve.codina@bootlin.com> wrote:
> 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: ae232e45acf9 ("backlight: add led-backlight driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>
I didn't receive any feedback.
v6.14-rc1 has been released since the patch was sent but the patch applies on
top of v6.14-rc1 without any issue.
Of course if really needed, I can resend the patch. Just tell me.
Best regards,
Hervé
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: (subset) [PATCH] backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()
2025-01-22 9:19 [PATCH] backlight: led_bl: Hold led_access lock when calling led_sysfs_disable() Herve Codina
2025-02-07 13:30 ` Herve Codina
@ 2025-02-11 14:12 ` Lee Jones
1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2025-02-11 14:12 UTC (permalink / raw)
To: Lee Jones, Daniel Thompson, Jingoo Han, Helge Deller,
Tony Lindgren, Pavel Machek, Tomi Valkeinen, Jean-Jacques Hiblot,
Herve Codina
Cc: Daniel Thompson, dri-devel, linux-fbdev, linux-kernel,
Luca Ceresoli, Thomas Petazzoni, stable
On Wed, 22 Jan 2025 10:19:14 +0100, Herve Codina wrote:
> 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
> ...
>
> [...]
Applied, thanks!
[1/1] backlight: led_bl: Hold led_access lock when calling led_sysfs_disable()
commit: 276822a00db3c1061382b41e72cafc09d6a0ec30
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-11 14:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-22 9:19 [PATCH] backlight: led_bl: Hold led_access lock when calling led_sysfs_disable() Herve Codina
2025-02-07 13:30 ` Herve Codina
2025-02-11 14:12 ` (subset) " Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).