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]
Date:   Mon, 1 Oct 2018 15:36:22 +0200
From:   Ricardo Ribalda Delgado <ricardo.ribalda@...il.com>
To:     Linus Walleij <linus.walleij@...aro.org>
Cc:     Timur Tabi <timur@...nel.org>, Jeffrey Hugo <jhugo@...eaurora.org>,
        Stephen Boyd <swboyd@...omium.org>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-gpio <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v2] gpiolib: Show correct direction from the beginning

Hi Linus
On Mon, Oct 1, 2018 at 1:54 PM Linus Walleij <linus.walleij@...aro.org> wrote:
>
> On Fri, Sep 28, 2018 at 9:30 PM Ricardo Ribalda Delgado
> <ricardo.ribalda@...il.com> wrote:
>
> > How do we proceed from here? Can you fix your driver somehow to
> > init the valid mask before enabling the gpio?
>
> Just include a hunk to the qcom driver reordering this call
> at the same time. No need to make it separate patches,
> it need to be tested together anyways.
>
> I guess just switch the order of these two:
>
>         ret = gpiochip_add_data(&pctrl->chip, pctrl);
>         if (ret) {
>                 dev_err(pctrl->dev, "Failed register gpiochip\n");
>                 return ret;
>         }
>
>         ret = msm_gpio_init_valid_mask(chip, pctrl);
>         if (ret) {
>                 dev_err(pctrl->dev, "Failed to setup irq valid bits\n");
>                 gpiochip_remove(&pctrl->chip);
>                 return ret;
>         }
>

the problem is that valid_mask is not a long/integer, is a struct that
needs to be malloced, and is malloc at gpiochip_add_data :(

Maybe we need a callback from the driver to init that mask just after
the allocation?

A fast grep shows that the only driver using need_valid_mask (not for
irq) is msm:

ricardo@...pili:~/curro/kernel-upstream$ git grep "need_valid_mask ="
| grep -v irq
drivers/gpio/gpiolib.c: gpiochip->need_valid_mask = true;
drivers/pinctrl/intel/pinctrl-cherryview.c: bool need_valid_mask =
!dmi_check_system(chv_no_valid_mask);
drivers/pinctrl/qcom/pinctrl-msm.c: chip->need_valid_mask =
msm_gpio_needs_valid_mask(pctrl);

so hacking something in the driver might not be a terrible idea.



Also

> > Do we need to make more severe changes on the core?
>
> Don't think so.
>
> Yours,
> Linus Walleij



-- 
Ricardo Ribalda

Powered by blists - more mailing lists