Re: [PATCH] gpiolib: Fix potential NULL pointer dereference in gpiod_get_label()

From: Bartosz Golaszewski
Date: Thu Oct 03 2024 - 14:55:26 EST


From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>


On Thu, 03 Oct 2024 14:13:51 +0100, Prabhakar wrote:
> 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.
>
> [...]

Good catch, thanks! I added Fixes: tags and queued it for rc2.

[1/1] gpiolib: Fix potential NULL pointer dereference in gpiod_get_label()
commit: 7b99b5ab885993bff010ebcd93be5e511c56e28a

Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>