]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
proc: Fix pointer error dereference
authorEthan Tidmore <ethantidmore06@gmail.com>
Thu, 19 Feb 2026 22:10:01 +0000 (16:10 -0600)
committerChristian Brauner <brauner@kernel.org>
Fri, 20 Feb 2026 10:21:16 +0000 (11:21 +0100)
The function try_lookup_noperm() can return an error pointer. Add check
for error pointer.

Detected by Smatch:
fs/proc/base.c:2148 proc_fill_cache() error:
'child' dereferencing possible ERR_PTR()

Fixes: 1df98b8bbcca ("proc_fill_cache(): clean up, get rid of pointless find_inode_number() use")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
Link: https://patch.msgid.link/20260219221001.1117135-1-ethantidmore06@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/proc/base.c

index 4eec684baca9f75f4e0791fc84666b60f0aabd76..4c863d17dfb4c7f390b50fbcfdba5a7dfa4d40ed 100644 (file)
@@ -2128,6 +2128,9 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
        ino_t ino = 1;
 
        child = try_lookup_noperm(&qname, dir);
+       if (IS_ERR(child))
+               goto end_instantiate;
+
        if (!child) {
                DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
                child = d_alloc_parallel(dir, &qname, &wq);