[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 9 Sep 2017 18:03:16 +0530
From: Gargi Sharma <gs051095@...il.com>
To: linux-kernel@...r.kernel.org
Cc: riel@...riel.com, julia.lawall@...6.fr, akpm@...ux-foundation.org,
mingo@...nel.org, pasha.tatashin@...cle.com, ktkhai@...tuozzo.com,
oleg@...hat.com, wangkefeng.wang@...wei.org,
Gargi Sharma <gs051095@...il.com>
Subject: [RFC 1/2] proc: Return if nothing to unmount
If a task exits before procfs is mounted, proc_flush_task_mnt will
be called with a NULL mnt parameter. In that case, not only is there
nothing to unhash, but trying to do so will oops the kernel with a
null pointer dereference.
Signed-off-by: Gargi Sharma <gs051095@...il.com>
---
fs/proc/base.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/proc/base.c b/fs/proc/base.c
index e5d89a0..7b83c21 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -3021,6 +3021,10 @@ static void proc_flush_task_mnt(struct vfsmount *mnt, pid_t pid, pid_t tgid)
char buf[PROC_NUMBUF];
struct qstr name;
+ /* procfs is not mounted. There is nothing to unhash. */
+ if (!mnt)
+ return;
+
name.name = buf;
name.len = snprintf(buf, sizeof(buf), "%d", pid);
/* no ->d_hash() rejects on procfs */
--
2.7.4
Powered by blists - more mailing lists