[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210309095527.27969-1-baijiaju1990@gmail.com>
Date: Tue, 9 Mar 2021 01:55:27 -0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: adobriyan@...il.com, christian@...uner.io, ebiederm@...ssion.com,
akpm@...ux-foundation.org, keescook@...omium.org,
gladkov.alexey@...il.com, walken@...gle.com,
bernd.edlinger@...mail.de, avagin@...il.com, deller@....de
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] fs: proc: fix error return code of proc_map_files_readdir()
When get_task_mm() returns NULL to mm, no error return code of
proc_map_files_readdir() is assigned.
To fix this bug, ret is assigned with -ENOENT in this case.
Fixes: f0c3b5093add ("[readdir] convert procfs")
Reported-by: TOTE Robot <oslab@...nghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
fs/proc/base.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3851bfcdba56..254cc6ac65fb 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2332,8 +2332,10 @@ proc_map_files_readdir(struct file *file, struct dir_context *ctx)
goto out_put_task;
mm = get_task_mm(task);
- if (!mm)
+ if (!mm) {
+ ret = -ENOENT;
goto out_put_task;
+ }
ret = mmap_read_lock_killable(mm);
if (ret) {
--
2.17.1
Powered by blists - more mailing lists