linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: David Lechner <david@lechnology.com>,
	Richard Purdie <rpurdie@rpsys.net>,
	linux-kernel@vger.kernel.org, linux-leds@vger.kernel.org,
	Marcel Holtmann <marcel@holtmann.org>
Subject: Re: [PATCH v3] leds: Introduce userspace leds driver
Date: Fri, 16 Sep 2016 08:09:49 +0200	[thread overview]
Message-ID: <20160916060949.GE13205@amd> (raw)
In-Reply-To: <5e86399e-65a0-9251-d08e-ab8bfe1f5fbb@samsung.com>

On Thu 2016-09-15 16:54:35, Jacek Anaszewski wrote:
> Hi Pavel,
> 
> On 09/15/2016 03:35 PM, Pavel Machek wrote:
> >Hi!
> >
> >>>>+	if (copy_from_user(&udev->user_dev, buffer,
> >>>>+			   sizeof(struct uleds_user_dev))) {
> >>>>+		ret = -EFAULT;
> >>>>+		goto out;
> >>>>+	}
> >>>>+
> >>>>+	if (!udev->user_dev.name[0]) {
> >>>>+		ret = -EINVAL;
> >>>>+		goto out;
> >>>>+	}
> >>>>+
> >>>>+	ret = led_classdev_register(NULL, &udev->led_cdev);
> >>>>+	if (ret < 0)
> >>>>+		goto out;
> >>
> >>No sanity checking on the name -> probably a security hole. Do not
> >>push this upstream before this is fixed.
> >
> >And actually... is it possible to have more then one userspace LED
> >with this interface? I do have RGB LED connect on /dev/ttyUSB0, and I
> >guess userspace driver would be appropriate, but it needs 3
> >channels...
> 
> Each new successful write to /dev/uleds creates a new LED class device.
> 
> See Documentation/leds/uleds.txt.

Umm. No, only one write is permitted to /dev/uleds according to the
code. In the email thread, it says:

# With this patch, you can create multiple LEDs. You just have to open a
# file handle to /dev/uleds for each LED that you want to create. Also,
# the LED device is automatically destroyed when the file handle is
# closed. I think this is nice because if the program that created it
# crashes, then it is automatically cleaned up.

...which should be actually ok. Sorry for the noise.

Best regards,
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  reply	other threads:[~2016-09-16  6:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-09 16:49 [PATCH v3] leds: Introduce userspace leds driver David Lechner
     [not found] ` <alpine.LRH.2.20.1609091525060.22407@federalhill.net>
2016-09-09 20:44   ` David Lechner
     [not found] ` <CGME20160912081846eucas1p255044e49034685ad44400d6830ef0b95@eucas1p2.samsung.com>
2016-09-12  8:18   ` Jacek Anaszewski
2016-09-12 14:58     ` David Lechner
2016-09-15 13:08     ` Pavel Machek
2016-09-15 13:35       ` Pavel Machek
2016-09-15 14:54         ` Jacek Anaszewski
2016-09-16  6:09           ` Pavel Machek [this message]
2016-09-15 14:54       ` Jacek Anaszewski
2016-09-15 15:31         ` David Lechner
2016-09-15 15:35           ` David Lechner
2016-09-16  5:51           ` Pavel Machek
2016-09-16 15:18             ` David Lechner
2016-09-16  5:59           ` Pavel Machek
2016-09-16 15:32             ` David Lechner
2016-09-16  6:07           ` Pavel Machek
2016-09-16 15:41             ` David Lechner
2016-09-15 16:34         ` David Lechner
2016-09-16  5:50           ` Pavel Machek
2016-09-16  7:07             ` Jacek Anaszewski
2016-09-16 15:09               ` David Lechner
2016-09-16 19:29                 ` Pavel Machek

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=20160916060949.GE13205@amd \
    --to=pavel@ucw.cz \
    --cc=david@lechnology.com \
    --cc=j.anaszewski@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=rpurdie@rpsys.net \
    /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).