summaryrefslogtreecommitdiff
path: root/fs/ext2/ext2.h
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2023-03-01 11:59:39 +0100
committerJan Kara <jack@suse.cz>2023-03-06 16:42:10 +0100
commit62aeb94433fcec80241754b70d0d1836d5926b0a (patch)
tree5b191d6bd8f8289d41507f3f67728d6ebf29134e /fs/ext2/ext2.h
parente9cd1d9a34131fb56bef469d4e1cd31bd1b515e2 (diff)
ext2: Check block size validity during mount
Check that log of block size stored in the superblock has sensible value. Otherwise the shift computing the block size can overflow leading to undefined behavior. Reported-by: syzbot+4fec412f59eba8c01b77@syzkaller.appspotmail.com Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2/ext2.h')
-rw-r--r--fs/ext2/ext2.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index 6c8e838bb278..8244366862e4 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -180,6 +180,7 @@ static inline struct ext2_sb_info *EXT2_SB(struct super_block *sb)
#define EXT2_MIN_BLOCK_SIZE 1024
#define EXT2_MAX_BLOCK_SIZE 65536
#define EXT2_MIN_BLOCK_LOG_SIZE 10
+#define EXT2_MAX_BLOCK_LOG_SIZE 16
#define EXT2_BLOCK_SIZE(s) ((s)->s_blocksize)
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_blocksize_bits)