* Locking in LED core really not needed or missing?
@ 2016-01-08 20:31 Heiner Kallweit
2016-01-10 8:17 ` Jacek Anaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2016-01-08 20:31 UTC (permalink / raw)
To: linux-leds; +Cc: Jacek Anaszewski
I'm a little puzzled about the more or less completely missing locking in the LED core.
Let's just take led_timer_function as example.
It modifies led_cdev->flags and led_cdev->brightness from soft irq context
(soft blink timer) w/o locking. Accessing these fields is not guaranteed to be atomic
and the function doesn't even use set_bit etc. for modifying the bitmap.
And brightness_set and other exported functions can even be called from
hard irq context (e.g. by triggers).
This seems to be quite unsafe to me. Just think of a soft or hard irq colliding
with a sysfs access. IMHO it's just due to the fact that these collision scenarios
are relatively unlikely that we don't have problems.
Am I missing something or is this actually an open issue?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Locking in LED core really not needed or missing?
2016-01-08 20:31 Locking in LED core really not needed or missing? Heiner Kallweit
@ 2016-01-10 8:17 ` Jacek Anaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Jacek Anaszewski @ 2016-01-10 8:17 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: linux-leds, Jacek Anaszewski
Hi Heiner,
On 01/08/2016 09:31 PM, Heiner Kallweit wrote:
> I'm a little puzzled about the more or less completely missing locking in the LED core.
>
> Let's just take led_timer_function as example.
> It modifies led_cdev->flags and led_cdev->brightness from soft irq context
> (soft blink timer) w/o locking. Accessing these fields is not guaranteed to be atomic
> and the function doesn't even use set_bit etc. for modifying the bitmap.
>
> And brightness_set and other exported functions can even be called from
> hard irq context (e.g. by triggers).
led_set_brightness() behaves differently when blink timer is enabled.
This issue was initially addressed by the patch [1].
Currently even more related improvements sit on linux-next.
> This seems to be quite unsafe to me. Just think of a soft or hard irq colliding
> with a sysfs access. IMHO it's just due to the fact that these collision scenarios
> are relatively unlikely that we don't have problems.
> Am I missing something or is this actually an open issue?
> --
> To unsubscribe from this list: send the line "unsubscribe linux-leds" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
[1] http://www.spinics.net/lists/linux-leds/msg00006.html
--
Best Regards,
Jacek Anaszewski
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-10 8:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-08 20:31 Locking in LED core really not needed or missing? Heiner Kallweit
2016-01-10 8:17 ` Jacek Anaszewski
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.