Skip to content

Commit 175efa8

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 9f364e1 commit 175efa8

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
@@ -733,7 +733,7 @@ enum {
733733
#define EXT4_MAX_BLOCK_FILE_PHYS 0xFFFFFFFF
734734

735735
/* Max logical block we can support */
736-
#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFF
736+
#define EXT4_MAX_LOGICAL_BLOCK 0xFFFFFFFE
737737

738738
/*
739739
* Structure of an inode on the disk

0 commit comments

Comments
 (0)