]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: check for invalid block size early when mounting a file system
authorTheodore Ts'o <tytso@mit.edu>
Wed, 9 Dec 2020 20:59:11 +0000 (15:59 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 17 Dec 2020 18:30:32 +0000 (13:30 -0500)
commite3359520ae53fd6aedfaca732dcc4cc2a7e4e5f2
tree75e10adede70bd577d7d58fe255bbab6fea4159e
parent6e61572764729fceeeaac0dc807f059787c150cb
ext4: check for invalid block size early when mounting a file system

Check for valid block size directly by validating s_log_block_size; we
were doing this in two places.  First, by calculating blocksize via
BLOCK_SIZE << s_log_block_size, and then checking that the blocksize
was valid.  And then secondly, by checking s_log_block_size directly.

The first check is not reliable, and can trigger an UBSAN warning if
s_log_block_size on a maliciously corrupted superblock is greater than
22.  This is harmless, since the second test will correctly reject the
maliciously fuzzed file system, but to make syzbot shut up, and
because the two checks are duplicative in any case, delete the
blocksize check, and move the s_log_block_size earlier in
ext4_fill_super().

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: syzbot+345b75652b1d24227443@syzkaller.appspotmail.com
fs/ext4/super.c