lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200903093120.GA160697@sol>
Date:   Thu, 3 Sep 2020 17:31:20 +0800
From:   Kent Gibson <warthog618@...il.com>
To:     Bartosz Golaszewski <bgolaszewski@...libre.com>
Cc:     LKML <linux-kernel@...r.kernel.org>,
        linux-gpio <linux-gpio@...r.kernel.org>,
        Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH v6 11/20] gpiolib: cdev: support
 GPIO_V2_LINE_SET_VALUES_IOCTL

On Thu, Sep 03, 2020 at 09:59:17AM +0200, Bartosz Golaszewski wrote:
> On Mon, Aug 31, 2020 at 5:23 AM Kent Gibson <warthog618@...il.com> wrote:
> >
> > Add support for the GPIO_V2_LINE_SET_VALUES_IOCTL.
> >
> > Signed-off-by: Kent Gibson <warthog618@...il.com>
> > ---
> >  drivers/gpio/gpiolib-cdev.c | 59 +++++++++++++++++++++++++++++++++++++
> >  1 file changed, 59 insertions(+)
> >
> > diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
> > index 936b8c9958dd..9f05bbd2161e 100644
> > --- a/drivers/gpio/gpiolib-cdev.c
> > +++ b/drivers/gpio/gpiolib-cdev.c
> > @@ -777,6 +777,63 @@ static long linereq_get_values(struct linereq *lr, void __user *ip)
> >         return 0;
> >  }
> >
> > +static long linereq_set_values_unlocked(struct linereq *lr,
> > +                                       struct gpio_v2_line_values *lv)
> > +{
> > +       DECLARE_BITMAP(vals, GPIO_V2_LINES_MAX);
> > +       struct gpio_desc **descs;
> > +       unsigned int i, didx, num_set;
> > +       int ret;
> > +
> > +       bitmap_zero(vals, GPIO_V2_LINES_MAX);
> > +       for (num_set = 0, i = 0; i < lr->num_lines; i++) {
> > +               if (lv->mask & BIT_ULL(i)) {
> > +                       if (!test_bit(FLAG_IS_OUT, &lr->lines[i].desc->flags))
> > +                               return -EPERM;
> > +                       if (lv->bits & BIT_ULL(i))
> > +                               __set_bit(num_set, vals);
> > +                       num_set++;
> > +                       descs = &lr->lines[i].desc;
> > +               }
> > +       }
> > +       if (num_set == 0)
> > +               return -EINVAL;
> > +
> > +       if (num_set != 1) {
> > +               /* build compacted desc array and values */
> > +               descs = kmalloc_array(num_set, sizeof(*descs), GFP_KERNEL);
> 
> Missing retval check.
> 

Arrgh, that has been there since PATCH v2!
And subsequently got propagated into patch 07 :-(.

Kent.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ