linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: linux-leds@vger.kernel.org, Jacek Anaszewski <j.anaszewski@samsung.com>
Subject: Re: Locking in LED core really not needed or missing?
Date: Sun, 10 Jan 2016 09:17:31 +0100	[thread overview]
Message-ID: <5692139B.3070804@gmail.com> (raw)
In-Reply-To: <56901C90.2050801@gmail.com>

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

      reply	other threads:[~2016-01-10  8:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08 20:31 Locking in LED core really not needed or missing? Heiner Kallweit
2016-01-10  8:17 ` Jacek Anaszewski [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5692139B.3070804@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-leds@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).