Skip to content

Commit 9f44eda

Browse files
riteshharjanitytso
authored andcommitted
ext4: fix EXT4_MAX_LOGICAL_BLOCK macro
ext4 supports max number of logical blocks in a file to be 0xffffffff. (This is since ext4_extent's ee_block is __le32). This means that EXT4_MAX_LOGICAL_BLOCK should be 0xfffffffe (starting from 0 logical offset). This patch fixes this. The issue was seen when ext4 moved to iomap_fiemap API and when overlayfs was mounted on top of ext4. Since overlayfs was missing filemap_check_ranges(), so it could pass a arbitrary huge length which lead to overflow of map.m_len logic. This patch fixes that. Fixes: d3b6f23 ("ext4: move ext4_fiemap to use iomap framework") Reported-by: [email protected] Signed-off-by: Ritesh Harjani <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 0e698df commit 9f44eda

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/ext4/ext4.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ enum {
722722
#define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF
723723

724724
/* Max logical block we can support */
725-
#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFF
725+
#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFE
726726

727727
/*
728728
* Structure of an inode on the disk

0 commit comments

Comments
 (0)