Lad Prabhakar 7b99b5ab88 gpiolib: Fix potential NULL pointer dereference in gpiod_get_label()
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`.

Fixes: 5a646e03e956 ("gpiolib: Return label, if set, for IRQ only line")
Fixes: a86d27693066 ("gpiolib: fix the speed of descriptor label setting with SRCU")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20241003131351.472015-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-03 20:51:47 +02:00
..
2021-04-14 10:19:22 +01:00
2024-02-12 10:12:41 +01:00
2023-10-13 08:39:30 +02:00
2021-05-05 16:07:41 +02:00
2022-10-26 14:52:01 +02:00
2024-07-15 17:53:24 -07:00
2022-10-08 09:46:29 -07:00
2023-10-04 11:37:25 +02:00
2023-08-21 10:39:58 +02:00
2023-03-06 12:33:02 +02:00
2024-09-04 09:02:44 +02:00
2023-10-31 17:21:54 -10:00
2023-08-29 10:21:56 -07:00
2019-12-09 10:40:18 +01:00