]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
gpio: cdev: Avoid NULL dereference in linehandle_create()
authorDouglas Anderson <dianders@chromium.org>
Sun, 15 Feb 2026 20:05:55 +0000 (12:05 -0800)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Mon, 16 Feb 2026 11:20:50 +0000 (12:20 +0100)
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>
drivers/gpio/gpiolib-cdev.c

index 2adc3c070908225c9ccfe7b90498cea3b3adc9c4..189127721e3832adff61462d46cf46cf403d0743 100644 (file)
@@ -388,7 +388,7 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
        fd_publish(fdf);
 
        dev_dbg(&gdev->dev, "registered chardev handle for %d lines\n",
-               lh->num_descs);
+               handlereq.lines);
 
        return 0;
 }