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: <DFK46PUEYQFD.1ZE4WO3YCYQJ9@kernel.org>
Date: Fri, 09 Jan 2026 15:05:36 +0100
From: "Michael Walle" <mwalle@...nel.org>
To: "Bartosz Golaszewski" <bartosz.golaszewski@....qualcomm.com>, "Linus
 Walleij" <linusw@...nel.org>, "Bartosz Golaszewski" <brgl@...nel.org>
Cc: <linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH] gpiolib: remove redundant callback check

Hi,

On Fri Jan 9, 2026 at 11:55 AM CET, Bartosz Golaszewski wrote:
> The presence of the .get_direction() callback is already checked in
> gpiochip_get_direction(). Remove the duplicated check which also returns
> the wrong error code to user-space.
>
> Fixes: e623c4303ed1 ("gpiolib: sanitize the return value of gpio_chip::get_direction()")
> Reported-by: Michael Walle <mwalle@...nel.org>
> Closes: https://lore.kernel.org/all/DFJAFK3DTBOZ.3G2P3A5IH34GF@kernel.org/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>
> ---
>  drivers/gpio/gpiolib.c | 3 ---
>  1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 0a14085f3871..5eb918da7ea2 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -468,9 +468,6 @@ int gpiod_get_direction(struct gpio_desc *desc)
>  	    test_bit(GPIOD_FLAG_IS_OUT, &flags))
>  		return 0;
>  
> -	if (!guard.gc->get_direction)
> -		return -ENOTSUPP;
> -

Not sure, if that will make it better or worse though.

>  	ret = gpiochip_get_direction(guard.gc, offset);

Because that will then do a WARN_ON(!.get_direction) and will spam
the kernel log in case of the gpio-shared-proxy. Also the return
code will change from ENOTSUPP to EOPNOTSUPP.

-michael

>  	if (ret < 0)
>  		return ret;


Download attachment "signature.asc" of type "application/pgp-signature" (298 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ