lkml.org 
[lkml]   [2018]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH 4.18 177/235] gpiolib: dont allow userspace to set values of input lines
    On Mon, Sep 24, 2018 at 02:57:38PM +0200, Bartosz Golaszewski wrote:
    > pon., 24 wrz 2018 o 14:41 Greg Kroah-Hartman
    > <gregkh@linuxfoundation.org> napisał(a):
    > >
    > > 4.18-stable review patch. If anyone has any objections, please let me know.
    > >
    > > ------------------
    > >
    > > From: Bartosz Golaszewski <brgl@bgdev.pl>
    > >
    > > [ Upstream commit e5332d5437764f775cf4e3b8ca3bf592af063a02 ]
    > >
    > > User space can currently both read and set values of input lines using
    > > the character device. This was not allowed by the old sysfs interface
    > > nor is it a correct behavior.
    > >
    > > Check the first descriptor in the set for the OUT flag when asked to
    > > set values and return -EPERM if the line is input.
    > >
    > > Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
    > > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
    > > Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    > > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    > > ---
    > > drivers/gpio/gpiolib.c | 8 +++++++-
    > > 1 file changed, 7 insertions(+), 1 deletion(-)
    > >
    > > --- a/drivers/gpio/gpiolib.c
    > > +++ b/drivers/gpio/gpiolib.c
    > > @@ -449,7 +449,13 @@ static long linehandle_ioctl(struct file
    > >
    > > return 0;
    > > } else if (cmd == GPIOHANDLE_SET_LINE_VALUES_IOCTL) {
    > > - /* TODO: check if descriptors are really output */
    > > + /*
    > > + * All line descriptors were created at once with the same
    > > + * flags so just check if the first one is really output.
    > > + */
    > > + if (!test_bit(FLAG_IS_OUT, &lh->descs[0]->flags))
    > > + return -EPERM;
    > > +
    > > if (copy_from_user(&ghd, ip, sizeof(ghd)))
    > > return -EFAULT;
    > >
    > >
    > >
    >
    > Hi Greg,
    >
    > FYI Linus suggested that we don't send this one for stable:
    > https://lkml.org/lkml/2018/7/20/1065

    Ok, that was hard to dig out. This was sent as review last week. I'll
    go drop it, thanks for letting me know.

    greg k-h

    \
     
     \ /
      Last update: 2018-09-24 20:07    [W:4.045 / U:0.220 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site