Skip to content

Commit f6a4954

Browse files
Ethan Tidmorebrauner
authored andcommitted
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: 1df98b8 ("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>
1 parent 768f4dc commit f6a4954

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/proc/base.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,9 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
21282128
ino_t ino = 1;
21292129

21302130
child = try_lookup_noperm(&qname, dir);
2131+
if (IS_ERR(child))
2132+
goto end_instantiate;
2133+
21312134
if (!child) {
21322135
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
21332136
child = d_alloc_parallel(dir, &qname, &wq);

0 commit comments

Comments
 (0)