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: <twqaezumdhalpivd46xkevzbfkwouwfrpr7wbw7yjeqcxberzv@sp36opkfttne>
Date: Wed, 18 Jun 2025 19:53:46 +0200
From: Klara Modin <klarasmodin@...il.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Avi Fishman <avifishman70@...il.com>, 
	Tomer Maimon <tmaimon77@...il.com>, Tali Perry <tali.perry1@...il.com>, 
	Patrick Venture <venture@...gle.com>, Nancy Yuen <yuenn@...gle.com>, 
	Benjamin Fair <benjaminfair@...gle.com>, Linus Walleij <linus.walleij@...aro.org>, 
	openbmc@...ts.ozlabs.org, linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org, 
	Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH 2/2] gpio: mmio: don't use legacy GPIO chip setters

On 2025-06-18 15:02:07 +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> 
> We've converted this driver to using the new GPIO line value setters but
> missed the instances where the legacy callback is accessed directly using
> the function pointer. This will lead to a NULL-pointer dereference as
> this pointer is no longer populated. The issue needs fixing locally as
> well as in the already converted previously users of gpio-mmio.
> 
> Fixes: b908d35d0003 ("gpio: mmio: use new GPIO line value setter callbacks")
> Reported-by: Klara Modin <klarasmodin@...il.com>
> Closes: https://lore.kernel.org/all/2rw2sncevdiyirpdovotztlg77apcq2btzytuv5jnm55aqhlne@swtts3hl53tw/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
> ---
>  drivers/gpio/gpio-74xx-mmio.c | 2 +-
>  drivers/gpio/gpio-en7523.c    | 2 +-
>  drivers/gpio/gpio-mmio.c      | 6 +++---
>  3 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-74xx-mmio.c b/drivers/gpio/gpio-74xx-mmio.c
> index c7ac5a9ffb1fd1cc9439e3320d54574bf0cebbf6..3ba21add3a1c669171578ceaf9cc1728c060d401 100644
> --- a/drivers/gpio/gpio-74xx-mmio.c
> +++ b/drivers/gpio/gpio-74xx-mmio.c
> @@ -100,7 +100,7 @@ static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
>  	struct mmio_74xx_gpio_priv *priv = gpiochip_get_data(gc);
>  
>  	if (priv->flags & MMIO_74XX_DIR_OUT) {
> -		gc->set(gc, gpio, val);
> +		gc->set_rv(gc, gpio, val);
>  		return 0;
>  	}
>  
> diff --git a/drivers/gpio/gpio-en7523.c b/drivers/gpio/gpio-en7523.c
> index 69834db2c1cf26be379c0deca38dda889202f706..c08069d0d1045e9df4a76cad4600bf25d4e3a7c5 100644
> --- a/drivers/gpio/gpio-en7523.c
> +++ b/drivers/gpio/gpio-en7523.c
> @@ -50,7 +50,7 @@ static int airoha_dir_set(struct gpio_chip *gc, unsigned int gpio,
>  	iowrite32(dir, ctrl->dir[gpio / 16]);
>  
>  	if (out)
> -		gc->set(gc, gpio, val);
> +		gc->set_rv(gc, gpio, val);
>  
>  	iowrite32(output, ctrl->output);
>  
> diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
> index 9169eccadb238efe944d494054b1e009f16eee7f..57622f45d33e0695f97c7e0fa40e64f9fd5df1e0 100644
> --- a/drivers/gpio/gpio-mmio.c
> +++ b/drivers/gpio/gpio-mmio.c
> @@ -362,7 +362,7 @@ static int bgpio_dir_out_err(struct gpio_chip *gc, unsigned int gpio,
>  static int bgpio_simple_dir_out(struct gpio_chip *gc, unsigned int gpio,
>  				int val)
>  {
> -	gc->set(gc, gpio, val);
> +	gc->set_rv(gc, gpio, val);
>  
>  	return bgpio_dir_return(gc, gpio, true);
>  }
> @@ -427,14 +427,14 @@ static int bgpio_dir_out_dir_first(struct gpio_chip *gc, unsigned int gpio,
>  				   int val)
>  {
>  	bgpio_dir_out(gc, gpio, val);
> -	gc->set(gc, gpio, val);
> +	gc->set_rv(gc, gpio, val);
>  	return bgpio_dir_return(gc, gpio, true);
>  }
>  
>  static int bgpio_dir_out_val_first(struct gpio_chip *gc, unsigned int gpio,
>  				   int val)
>  {
> -	gc->set(gc, gpio, val);
> +	gc->set_rv(gc, gpio, val);
>  	bgpio_dir_out(gc, gpio, val);
>  	return bgpio_dir_return(gc, gpio, true);
>  }
> 
> -- 
> 2.48.1
> 

This also fixes the null pointer dereference for me on the Banana Pi
BPI-F3 from my report.

Thanks,
Tested-by: Klara Modin <klarasmodin@...il.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ