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] [day] [month] [year] [list]
Message-ID: <CAMuHMdU-79wt71k_kCE5OrRzsKG+qDu+W6E1JJe0LnfjywRkQg@mail.gmail.com>
Date: Fri, 4 Oct 2024 09:40:00 +0200
From: Geert Uytterhoeven <geert@...ux-m68k.org>
To: Prabhakar <prabhakar.csengg@...il.com>
Cc: Linus Walleij <linus.walleij@...aro.org>, Bartosz Golaszewski <brgl@...ev.pl>, linux-gpio@...r.kernel.org, 
	linux-kernel@...r.kernel.org, linux-renesas-soc@...r.kernel.org, 
	Biju Das <biju.das.jz@...renesas.com>, 
	Fabrizio Castro <fabrizio.castro.jz@...esas.com>, 
	Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
Subject: Re: [PATCH] gpiolib: Fix potential NULL pointer dereference in gpiod_get_label()

On Thu, Oct 3, 2024 at 3:14 PM Prabhakar <prabhakar.csengg@...il.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>
>
> In `gpiod_get_label()`, it is possible that `srcu_dereference_check()` may
> return a NULL pointer, leading to a scenario where `label->str` is accessed
> without verifying if `label` itself is NULL.
>
> This patch adds a proper NULL check for `label` before accessing
> `label->str`. The check for `label->str != NULL` is removed because
> `label->str` can never be NULL if `label` is not NULL.
>
> This fixes the issue where the label name was being printed as `(efault)`
> when dumping the sysfs GPIO file when `label == NULL`.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>

Neat!

Took me an aha-erlebnis to realize why it didn't crash immediately when
accessing label->str, but it just returns the address relative to the
zero base...

Reviewed-by: Geert Uytterhoeven <geert+renesas@...der.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@...ux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ