* [PATCH] proc: Fix pointer error dereference
@ 2026-02-19 22:10 Ethan Tidmore
0 siblings, 0 replies; only message in thread
From: Ethan Tidmore @ 2026-02-19 22:10 UTC (permalink / raw)
To: akpm, brauner, viro, linux-fsdevel, linux-kernel
Cc: lorenzo.stoakes, Liam.Howlett, rppt, neil, bvanassche,
superman.xpt, tglx, oleg, mingo, ebiederm, Ethan Tidmore
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: 61a28784028e6 ("proc: Remove the hard coded inode numbers")
Signed-off-by: Ethan Tidmore <ethantidmore06@gmail.com>
---
fs/proc/base.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 4eec684baca9..4c863d17dfb4 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -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);
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-19 22:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-19 22:10 [PATCH] proc: Fix pointer error dereference Ethan Tidmore
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®