Skip to content

Commit 058f2e4

Browse files
legionusebiederm
authored andcommitted
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@syzkaller.appspotmail.com Fixes: fa10fed ("proc: allow to mount many instances of proc in one pid namespace") Signed-off-by: Alexey Gladkov <gladkov.alexey@gmail.com> Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
1 parent 9d78ede commit 058f2e4

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

fs/proc/root.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,13 @@ static void proc_kill_sb(struct super_block *sb)
264264
{
265265
struct proc_fs_info *fs_info = proc_sb_info(sb);
266266

267-
if (fs_info->proc_self)
268-
dput(fs_info->proc_self);
267+
if (!fs_info) {
268+
kill_anon_super(sb);
269+
return;
270+
}
269271

270-
if (fs_info->proc_thread_self)
271-
dput(fs_info->proc_thread_self);
272+
dput(fs_info->proc_self);
273+
dput(fs_info->proc_thread_self);
272274

273275
kill_anon_super(sb);
274276
put_pid_ns(fs_info->pid_ns);

0 commit comments

Comments
 (0)