Commit 36f597b
Bartosz Golaszewski
gpiolib: fix lookup table matching
If on any iteration in gpiod_find(), gpio_desc_table_match() returns
NULL (which is normal and expected), we never reinitialize desc back to
ERR_PTR(-ENOENT) and if we don't find a match later on, we will return
NULL causing a NULL-pointer dereference in users not expecting it. Don't
initialize desc, but return ERR_PTR(-ENOENT) explicitly at the end of
the function.
Fixes: 9700b0f ("gpiolib: allow multiple lookup tables per consumer")
Reported-by: Marek Szyprowski <m.szyprowski@samsung.com>
Closes: https://lore.kernel.org/all/00107523-7737-4b92-a785-14ce4e93b8cb@samsung.com/
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20260108102314.18816-1-bartosz.golaszewski@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>1 parent a802080 commit 36f597b
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4602 | 4602 | | |
4603 | 4603 | | |
4604 | 4604 | | |
4605 | | - | |
4606 | 4605 | | |
| 4606 | + | |
4607 | 4607 | | |
4608 | 4608 | | |
4609 | 4609 | | |
| |||
4619 | 4619 | | |
4620 | 4620 | | |
4621 | 4621 | | |
4622 | | - | |
| 4622 | + | |
4623 | 4623 | | |
4624 | 4624 | | |
4625 | 4625 | | |
| |||
0 commit comments