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]
Message-ID: <CAHp75VdZuqP_ga_i1=kERQbscu55GFShPK_AhYF1jigoBz8wpg@mail.gmail.com>
Date: Wed, 7 May 2025 18:24:10 +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 Wed, May 7, 2025 at 4:54 PM Thomas Richard
<thomas.richard@...tlin.com> wrote:
> On 5/7/25 15:24, Andy Shevchenko wrote:
> > On Wed, May 7, 2025 at 1:10 PM Thomas Richard
> > <thomas.richard@...tlin.com> wrote:
> >> On 5/7/25 08:34, Andy Shevchenko wrote:
> >>> On Tue, May 6, 2025 at 6:21 PM Thomas Richard
> >>> <thomas.richard@...tlin.com> wrote:

...

> >>>> +       /*
> >>>> +        * 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.
> >>
> >> I reproduced gpiolib behavior. During gpiochip registration, we get the
> >> direction of all lines. In the case the line is not valid, it is marked
> >> as input if direction_input operation exists, otherwise it is marked as
> >> output. [1]
> >>
> >> But in fact we could return an error and the core will mark the line as
> >> input. Maybe ENODEV ?
> >
> > I am fine with this error code, but do we have similar cases already
> > in the kernel? Do they use the same or different error code(s)?
>
> I dumped all get_direction() operations in drivers/gpio and
> drivers/pinctrl and returned values are:
> - GPIO_LINE_DIRECTION_OUT and GPIO_LINE_DIRECTION_IN (make sense).
> - -EINVAL (for example [1]).
> - -EBADE in gpiochip_get_direction() [2].
> - regmap_read() return code.
>
> But from my point of view -EINVAL and -EBADE do not match our case.

Hmm... I believe we need a GPIO maintainer to have a look at this.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ