Re: [PATCH] gpio: fix line flag validation in lineevent_create

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



pon., 9 wrz 2019 o 09:31 Bartosz Golaszewski <brgl@xxxxxxxx> napisał(a):
>
> pon., 9 wrz 2019 o 05:24 Kent Gibson <warthog618@xxxxxxxxx> napisał(a):
> >
>
> Hi Kent,
>
> thanks for spotting this. Just single nit below:
>
> > lineevent_create should not allow any of GPIOHANDLE_REQUEST_OUTPUT,
> > GPIOHANDLE_REQUEST_OPEN_DRAIN or GPIOHANDLE_REQUEST_OPEN_SOURCE to be set.
> >
> > Signed-off-by: Kent Gibson <warthog618@xxxxxxxxx>
> > ---
> >  drivers/gpio/gpiolib.c | 10 ++++------
> >  1 file changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index cca749010cd0..5499ec7bc783 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -918,7 +918,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
> >                 goto out_free_label;
> >         }
> >
> > -       /* Return an error if a unknown flag is set */
> > +       /* Return an error if an unknown flag is set */
>
> Please don't sneak in changes unrelated to the patch. If you want to
> fix the typo - do it in a separate one.
>
> >         if ((lflags & ~GPIOHANDLE_REQUEST_VALID_FLAGS) ||
> >             (eflags & ~GPIOEVENT_REQUEST_VALID_FLAGS)) {
> >                 ret = -EINVAL;
> > @@ -926,7 +926,9 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
> >         }
> >
> >         /* This is just wrong: we don't look for events on output lines */
> > -       if (lflags & GPIOHANDLE_REQUEST_OUTPUT) {
> > +       if ((lflags & GPIOHANDLE_REQUEST_OUTPUT) ||
> > +           (lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN) ||
> > +           (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE)) {
> >                 ret = -EINVAL;
> >                 goto out_free_label;
> >         }
> > @@ -940,10 +942,6 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
> >
> >         if (lflags & GPIOHANDLE_REQUEST_ACTIVE_LOW)
> >                 set_bit(FLAG_ACTIVE_LOW, &desc->flags);
> > -       if (lflags & GPIOHANDLE_REQUEST_OPEN_DRAIN)
> > -               set_bit(FLAG_OPEN_DRAIN, &desc->flags);
> > -       if (lflags & GPIOHANDLE_REQUEST_OPEN_SOURCE)
> > -               set_bit(FLAG_OPEN_SOURCE, &desc->flags);
> >
> >         ret = gpiod_direction_input(desc);
> >         if (ret)
> > --
> > 2.23.0
> >

Ok, so seeing that we'll still have another week for fixes, I thought
it would be nice to get those in before v5.3. I eventually applied
both patches and simply removed the typo fix.

Bart




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux