Skip to content

Commit 9c7d83a

Browse files
Tetsuo Handakees
authored andcommitted
pstore: Fix warning in pstore_kill_sb()
syzbot is hitting WARN_ON(pstore_sb != sb) at pstore_kill_sb() [1], for the assumption that pstore_sb != NULL is wrong because pstore_fill_super() will not assign pstore_sb = sb when new_inode() for d_make_root() returned NULL (due to memory allocation fault injection). Since mount_single() calls pstore_kill_sb() when pstore_fill_super() failed, pstore_kill_sb() needs to be aware of such failure path. [1] https://syzkaller.appspot.com/bug?id=6abacb8da5137cb47a416f2bef95719ed60508a0 Reported-by: syzbot <[email protected]> Signed-off-by: Tetsuo Handa <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 19d8e91 commit 9c7d83a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/pstore/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ static struct dentry *pstore_mount(struct file_system_type *fs_type,
467467
static void pstore_kill_sb(struct super_block *sb)
468468
{
469469
mutex_lock(&pstore_sb_lock);
470-
WARN_ON(pstore_sb != sb);
470+
WARN_ON(pstore_sb && pstore_sb != sb);
471471

472472
kill_litter_super(sb);
473473
pstore_sb = NULL;

0 commit comments

Comments
 (0)