Skip to content

Commit 0f68360

Browse files
jankarapanos
authored andcommitted
ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs
commit a60697f411eb365fb09e639e6f183fe33d1eb796 upstream. On 32-bit architectures with 32-bit sector_t computation of data offset in ext4_xattr_fiemap() can overflow resulting in reporting bogus data location. Fix the problem by typing block number to proper type before shifting. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 09a7f21 commit 0f68360

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

fs/ext4/extents.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4713,15 +4713,15 @@ static int ext4_xattr_fiemap(struct inode *inode,
47134713
error = ext4_get_inode_loc(inode, &iloc);
47144714
if (error)
47154715
return error;
4716-
physical = iloc.bh->b_blocknr << blockbits;
4716+
physical = (__u64)iloc.bh->b_blocknr << blockbits;
47174717
offset = EXT4_GOOD_OLD_INODE_SIZE +
47184718
EXT4_I(inode)->i_extra_isize;
47194719
physical += offset;
47204720
length = EXT4_SB(inode->i_sb)->s_inode_size - offset;
47214721
flags |= FIEMAP_EXTENT_DATA_INLINE;
47224722
brelse(iloc.bh);
47234723
} else { /* external block */
4724-
physical = EXT4_I(inode)->i_file_acl << blockbits;
4724+
physical = (__u64)EXT4_I(inode)->i_file_acl << blockbits;
47254725
length = inode->i_sb->s_blocksize;
47264726
}
47274727

0 commit comments

Comments
 (0)