lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200610130422.1197386-1-gladkov.alexey@gmail.com>
Date:   Wed, 10 Jun 2020 15:04:22 +0200
From:   Alexey Gladkov <gladkov.alexey@...il.com>
To:     ebiederm@...ssion.com
Cc:     syzbot <syzbot+4abac52934a48af5ff19@...kaller.appspotmail.com>,
        adobriyan@...il.com, keescook@...omium.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        syzkaller-bugs@...glegroups.com, viro@...iv.linux.org.uk
Subject: [PATCH] proc: s_fs_info may be NULL when proc_kill_sb is called

syzbot found that proc_fill_super() fails before filling up sb->s_fs_info,
deactivate_locked_super() will be called and sb->s_fs_info will be NULL.
The proc_kill_sb() does not expect fs_info to be NULL which is wrong.

Link: https://lore.kernel.org/lkml/0000000000002d7ca605a7b8b1c5@google.com
Reported-by: syzbot+4abac52934a48af5ff19@...kaller.appspotmail.com
Fixes: fa10fed30f25 ("proc: allow to mount many instances of proc in one pid namespace")
Signed-off-by: Alexey Gladkov <gladkov.alexey@...il.com>
---
 fs/proc/root.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/fs/proc/root.c b/fs/proc/root.c
index ffebed1999e5..a715eb9f196a 100644
--- a/fs/proc/root.c
+++ b/fs/proc/root.c
@@ -264,15 +264,18 @@ 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) {
+		if (fs_info->proc_self)
+			dput(fs_info->proc_self);
 
-	if (fs_info->proc_thread_self)
-		dput(fs_info->proc_thread_self);
+		if (fs_info->proc_thread_self)
+			dput(fs_info->proc_thread_self);
+
+		put_pid_ns(fs_info->pid_ns);
+		kfree(fs_info);
+	}
 
 	kill_anon_super(sb);
-	put_pid_ns(fs_info->pid_ns);
-	kfree(fs_info);
 }
 
 static struct file_system_type proc_fs_type = {
-- 
2.25.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ