summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-06-10 15:00:11 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-06-10 15:00:11 -0700
commit79ca035d2d941839f55f3b8b69f8e81c66946ed8 (patch)
treefc760528b0b60073642ceaff66b7f942251a6ff1
parent4152d146ee2169653297e03b9fa2e0f476923959 (diff)
parent058f2e4da79b23afb56ce3d03d907d6cdd36f2b8 (diff)
Merge branch 'proc-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull proc fix from Eric Biederman: "Syzbot found a NULL pointer dereference if kzalloc of s_fs_info fails" * 'proc-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: proc: s_fs_info may be NULL when proc_kill_sb is called
-rw-r--r--fs/proc/root.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/proc/root.c b/fs/proc/root.c
index ffebed1999e5..5e444d4f9717 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -264,11 +264,13 @@ static void proc_kill_sb(struct super_block *sb)
{
struct proc_fs_info *fs_info = proc_sb_info(sb);
- if (fs_info->proc_self)
- dput(fs_info->proc_self);
+ if (!fs_info) {
+ kill_anon_super(sb);
+ return;
+ }
- if (fs_info->proc_thread_self)
- dput(fs_info->proc_thread_self);
+ dput(fs_info->proc_self);
+ dput(fs_info->proc_thread_self);
kill_anon_super(sb);
put_pid_ns(fs_info->pid_ns);