Skip to content

Commit e2c4175

Browse files
author
Bartosz Golaszewski
committed
gpio: shared: fix NULL-pointer dereference in teardown path
We need to actually store the address of the GPIO lookup table in the reference struct before we try to free it or - worse - dereference its members. Fixes: a060b8c ("gpiolib: implement low-level, shared GPIO support") Link: https://lore.kernel.org/r/20251206-gpio-shared-teardown-fixes-v1-1-35ac458cfce1@oss.qualcomm.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
1 parent 9e7a40a commit e2c4175

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/gpio/gpiolib-shared.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ int gpio_shared_add_proxy_lookup(struct device *consumer, unsigned long lflags)
399399
lookup->table[0] = GPIO_LOOKUP(no_free_ptr(key), 0,
400400
ref->con_id, lflags);
401401

402-
gpiod_add_lookup_table(no_free_ptr(lookup));
402+
ref->lookup = no_free_ptr(lookup);
403+
gpiod_add_lookup_table(ref->lookup);
403404

404405
return 0;
405406
}

0 commit comments

Comments
 (0)