Skip to content

Commit 6af6be2

Browse files
diandersBartosz Golaszewski
authored andcommitted
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: da7e394 ("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>
1 parent 5843388 commit 6af6be2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/gpio/gpiolib-cdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
388388
fd_publish(fdf);
389389

390390
dev_dbg(&gdev->dev, "registered chardev handle for %d lines\n",
391-
lh->num_descs);
391+
handlereq.lines);
392392

393393
return 0;
394394
}

0 commit comments

Comments
 (0)