kernel_optimize_test/fs/pstore
Tetsuo Handa a7acb61428 pstore: Fix warning in pstore_kill_sb()
commit 9c7d83ae6ba67d6c6199cce24573983db3b56332 upstream.

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 <syzbot+d0cf0ad6513e9a1da5df@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210214031307.57903-1-penguin-kernel@I-love.SAKURA.ne.jp
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-25 09:04:08 +01:00
..
blk.c pstore/blk: Introduce "best_effort" mode 2020-05-31 19:49:01 -07:00
ftrace.c pstore/ftrace: Provide ftrace log merging routine 2020-05-30 10:34:02 -07:00
inode.c pstore: Fix warning in pstore_kill_sb() 2021-03-25 09:04:08 +01:00
internal.h pstore/ftrace: Provide ftrace log merging routine 2020-05-30 10:34:02 -07:00
Kconfig Documentation: Add details for pstore/blk 2020-05-30 10:34:03 -07:00
Makefile pstore/blk: Introduce backend for block devices 2020-05-30 10:34:03 -07:00
platform.c pstore: Fix typo in compression option name 2021-03-04 11:38:33 +01:00
pmsg.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
ram_core.c pstore: switch to copy_from_user() 2020-04-23 10:52:48 -04:00
ram.c pstore/ram: Introduce max_reason and convert dump_oops 2020-05-30 10:34:03 -07:00
zone.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00