Skip to content
Commit c9200760 authored by Theodore Ts'o's avatar Theodore Ts'o
Browse files

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: default avatarTheodore Ts'o <tytso@mit.edu>
Reported-by: default avatar <syzbot+345b75652b1d24227443@syzkaller.appspotmail.com>
parent cca41553
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment