Skip to content
  • Theodore Ts'o's avatar
    ext4: check for invalid block size early when mounting a file system · c9200760
    Theodore Ts'o authored
    
    
    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>
    c9200760