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: <CAHp75Vdg2LE885+qjpYLkQrdNqaahJc3=Ki7op=6jJUJfJM+sw@mail.gmail.com>
Date: Wed, 7 May 2025 09:34:47 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Thomas Richard <thomas.richard@...tlin.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, 
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>, Bartosz Golaszewski <brgl@...ev.pl>, 
	Geert Uytterhoeven <geert+renesas@...der.be>, Kees Cook <kees@...nel.org>, 
	Andy Shevchenko <andy@...nel.org>, linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org, 
	thomas.petazzoni@...tlin.com, DanieleCleri@...on.eu, GaryWang@...on.com.tw, 
	linux-hardening@...r.kernel.org
Subject: Re: [PATCH v5 09/12] gpio: aggregator: handle runtime registration of
 gpio_desc in gpiochip_fwd

On Tue, May 6, 2025 at 6:21 PM Thomas Richard
<thomas.richard@...tlin.com> wrote:
>
> Add request() callback to check if the GPIO descriptor was well registered
> in the gpiochip_fwd before using it. This is done to handle the case where
> GPIO descriptor is added at runtime in the forwarder.
>
> If at least one GPIO descriptor was not added before the forwarder
> registration, we assume the forwarder can sleep as if a GPIO is added at
> runtime it may sleep.

...

>  {
>         struct gpiochip_fwd *fwd = gpiochip_get_data(chip);
>
> +       /*
> +        * get_direction() is called during gpiochip registration, return input
> +        * direction if there is no descriptor for the line.
> +        */
> +       if (!test_bit(offset, fwd->valid_mask))
> +               return GPIO_LINE_DIRECTION_IN;

Can you remind me why we choose a valid return for invalid line? From
a pure code perspective this should return an error.

>         return gpiod_get_direction(fwd->descs[offset]);
>  }

...

> +       /*
> +        * Some gpio_desc were not registered. They will be registered at runtime
> +        * but we have to suppose they can sleep.

suppose --> assume ?

> +        */
> +       if (!bitmap_full(fwd->valid_mask, chip->ngpio))
> +               chip->can_sleep = true;

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ