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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 27 Apr 2023 05:40:00 +0000
From:   Christophe Leroy <christophe.leroy@...roup.eu>
To:     Andreas Kemnade <andreas@...nade.info>,
        "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
        "brgl@...ev.pl" <brgl@...ev.pl>,
        "andy.shevchenko@...il.com" <andy.shevchenko@...il.com>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        ": Tony Lindgren" <tony@...mide.com>,
        Aaro Koskinen <aaro.koskinen@....fi>,
        "linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>
Subject: Re: [PATCH] gpiolib: fix allocation of mixed dynamic/static GPIOs



Le 27/04/2023 à 00:03, Andreas Kemnade a écrit :
> [Vous ne recevez pas souvent de courriers de andreas@...nade.info. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ]
> 
> If static allocation and dynamic allocation GPIOs are present,
> dynamic allocation pollutes the numberspace for static allocation,
> causing static allocation to fail.
> Enfore dynamic allocation above GPIO_DYNAMIC_BASE.

Hum ....

Commit 7b61212f2a07 ("gpiolib: Get rid of ARCH_NR_GPIOS") was supposed 
to enforce dynamic allocation above GPIO_DYNAMIC_BASE already.

Can you describe what is going wrong exactly with the above commit ?

Thanks
Christophe

> 
> Seen on a GTA04 when omap-gpio (static) and twl-gpio (dynamic)
> raced.
> On that device it is fixed invasively by
> commit 92bf78b33b0b4 ("gpio: omap: use dynamic allocation of base")
> but lets also fix that for devices where there is still
> a mixture of static and dynamic allocation.
> 
> Fixes: 7b61212f2a07 ("gpiolib: Get rid of ARCH_NR_GPIOS")
> Suggested-by: andy.shevchenko@...il.com
> Signed-off-by: Andreas Kemnade <andreas@...nade.info>
> ---
>   drivers/gpio/gpiolib.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 19bd23044b017..18b68d0aec7db 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -188,6 +188,10 @@ static int gpiochip_find_base(int ngpio)
>          int base = GPIO_DYNAMIC_BASE;
> 
>          list_for_each_entry(gdev, &gpio_devices, list) {
> +               /* do not pollute area for static allocation */
> +               if (gdev->base < GPIO_DYNAMIC_BASE)
> +                       continue;
> +
>                  /* found a free space? */
>                  if (gdev->base >= base + ngpio)
>                          break;
> --
> 2.39.2
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ