ext2: Add more validity checks for inode counts
authorJan Kara <jack@suse.cz>
Tue, 26 Jul 2022 11:13:50 +0000 (13:13 +0200)
committerJan Kara <jack@suse.cz>
Tue, 26 Jul 2022 11:24:04 +0000 (13:24 +0200)
commitfa78f336937240d1bc598db817d638086060e7e9
tree2ea5ad4a49ba397fce611a5fc5b8c5d4cd89d812
parentbd6e21a9044ffc0d15cc362dcc10662e644a43bc
ext2: Add more validity checks for inode counts

Add checks verifying number of inodes stored in the superblock matches
the number computed from number of inodes per group. Also verify we have
at least one block worth of inodes per group. This prevents crashes on
corrupted filesystems.

Reported-by: syzbot+d273f7d7f58afd93be48@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
fs/ext2/super.c