android_kernel_xiaomi_sm7250/fs/nilfs2
Ryusuke Konishi bfc82a2654 nilfs2: fix use-after-free bug of struct nilfs_root
commit d325dc6eb763c10f591c239550b8c7e5466a5d09 upstream.

If the beginning of the inode bitmap area is corrupted on disk, an inode
with the same inode number as the root inode can be allocated and fail
soon after.  In this case, the subsequent call to nilfs_clear_inode() on
that bogus root inode will wrongly decrement the reference counter of
struct nilfs_root, and this will erroneously free struct nilfs_root,
causing kernel oopses.

This fixes the problem by changing nilfs_new_inode() to skip reserved
inode numbers while repairing the inode bitmap.

Link: https://lkml.kernel.org/r/20221003150519.39789-1-konishi.ryusuke@gmail.com
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Reported-by: syzbot+b8c672b0e22615c80fe0@syzkaller.appspotmail.com
Reported-by: Khalid Masum <khalid.masum.92@gmail.com>
Tested-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-10-26 13:19:22 +02:00
..
alloc.c
alloc.h
bmap.c
bmap.h
btnode.c nilfs2: fix lockdep warnings in page operations for btree nodes 2022-05-25 09:10:37 +02:00
btnode.h nilfs2: fix lockdep warnings in page operations for btree nodes 2022-05-25 09:10:37 +02:00
btree.c nilfs2: fix lockdep warnings in page operations for btree nodes 2022-05-25 09:10:37 +02:00
btree.h
cpfile.c
cpfile.h
dat.c nilfs2: fix lockdep warnings during disk space reclamation 2022-05-25 09:10:37 +02:00
dat.h
dir.c
direct.c
direct.h
export.h
file.c
gcinode.c nilfs2: fix lockdep warnings in page operations for btree nodes 2022-05-25 09:10:37 +02:00
ifile.c
ifile.h
inode.c nilfs2: fix use-after-free bug of struct nilfs_root 2022-10-26 13:19:22 +02:00
ioctl.c
Kconfig
Makefile
mdt.c nilfs2: fix lockdep warnings during disk space reclamation 2022-05-25 09:10:37 +02:00
mdt.h nilfs2: fix lockdep warnings during disk space reclamation 2022-05-25 09:10:37 +02:00
namei.c
nilfs.h nilfs2: fix incorrect masking of permission flags for symlinks 2022-07-21 21:09:26 +02:00
page.c nilfs2: fix lockdep warnings in page operations for btree nodes 2022-05-25 09:10:37 +02:00
page.h
recovery.c
segbuf.c
segbuf.h
segment.c nilfs2: replace WARN_ONs by nilfs_error for checkpoint acquisition failure 2022-10-26 13:19:18 +02:00
segment.h
sufile.c
sufile.h
super.c nilfs2: fix lockdep warnings in page operations for btree nodes 2022-05-25 09:10:37 +02:00
sysfs.c
sysfs.h
the_nilfs.c
the_nilfs.h