Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

gpio: cdev: Avoid NULL dereference in linehandle_create()

In linehandle_create(), there is a statement like this:
retain_and_null_ptr(lh);

Soon after, there is a debug printout that dereferences "lh", which
will crash things.

Avoid the crash by using handlereq.lines, which is the same value.

Fixes: da7e394bf58f ("gpio: convert linehandle_create() to FD_PREPARE()")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Link: https://patch.msgid.link/20260215120555.v2.1.I77c3eb563271c21870379eefd16ebbc4e09635bb@changeid
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

authored by

Douglas Anderson and committed by
Bartosz Golaszewski
6af6be27 58433885

+1 -1
+1 -1
drivers/gpio/gpiolib-cdev.c
··· 388 388 fd_publish(fdf); 389 389 390 390 dev_dbg(&gdev->dev, "registered chardev handle for %d lines\n", 391 - lh->num_descs); 391 + handlereq.lines); 392 392 393 393 return 0; 394 394 }