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: <1542ef65-508b-45be-ad5c-63ad124cb1a2@samsung.com>
Date: Fri, 16 Feb 2024 13:35:00 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: Bartosz Golaszewski <brgl@...ev.pl>, Kent Gibson <warthog618@...il.com>,
	Linus Walleij <linus.walleij@...aro.org>, "Paul E . McKenney"
	<paulmck@...nel.org>
Cc: linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org, Bartosz
	Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH] gpio: cdev: fix a NULL-pointer dereference with DEBUG
 enabled

On 16.02.2024 11:59, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> We are actually passing the gc pointer to chip_dbg() so we have to
> srcu_dereference() it.
>
> Fixes: 8574b5b47610 ("gpio: cdev: use correct pointer accessors with SRCU")
> Reported-by: Marek Szyprowski <m.szyprowski@...sung.com>
> Closes: https://lore.kernel.org/lkml/179caa10-5f86-4707-8bb0-fe1b316326d6@samsung.com/
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Tested-by: Marek Szyprowski <m.szyprowski@...sung.com>
> ---
>   drivers/gpio/gpiolib-cdev.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
> index 85037fa4925e..f384fa278764 100644
> --- a/drivers/gpio/gpiolib-cdev.c
> +++ b/drivers/gpio/gpiolib-cdev.c
> @@ -2795,8 +2795,8 @@ int gpiolib_cdev_register(struct gpio_device *gdev, dev_t devt)
>   		return ret;
>   
>   	guard(srcu)(&gdev->srcu);
> -
> -	if (!rcu_access_pointer(gdev->chip))
> +	gc = srcu_dereference(gdev->chip, &gdev->srcu);
> +	if (!gc)
>   		return -ENODEV;
>   
>   	chip_dbg(gc, "added GPIO chardev (%d:%d)\n", MAJOR(devt), gdev->id);

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ