Commit 058f2e4d authored by Alexey Gladkov's avatar Alexey Gladkov Committed by Eric W. Biederman
Browse files

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: default avatar <syzbot+4abac52934a48af5ff19@syzkaller.appspotmail.com>
Fixes: fa10fed3 ("proc: allow to mount many instances of proc in one pid namespace")
Signed-off-by: default avatarAlexey Gladkov <gladkov.alexey@gmail.com>
Signed-off-by: default avatarEric W. Biederman <ebiederm@xmission.com>
parent 9d78edea
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -264,10 +264,12 @@ 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_self);
	dput(fs_info->proc_thread_self);

	kill_anon_super(sb);