Unverified Commit f6a49548 authored by Ethan Tidmore's avatar Ethan Tidmore Committed by Christian Brauner
Browse files

proc: Fix pointer error dereference



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: 1df98b8b ("proc_fill_cache(): clean up, get rid of pointless find_inode_number() use")
Signed-off-by: default avatarEthan Tidmore <ethantidmore06@gmail.com>
Link: https://patch.msgid.link/20260219221001.1117135-1-ethantidmore06@gmail.com


Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent 768f4dc4
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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);