]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: fix EXT4_MAX_LOGICAL_BLOCK macro
authorRitesh Harjani <riteshh@linux.ibm.com>
Tue, 5 May 2020 15:43:14 +0000 (17:43 +0200)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:36:11 +0000 (08:36 -0400)
commitfa973313982dba660929c2b0bad1a11081595d05
tree8fd7d96ef509dfbf36fde37efa983217e2a2ef1e
parent86553e8de7787fbc2cdf35d03c15cfe5833ea951
ext4: fix EXT4_MAX_LOGICAL_BLOCK macro

commit 175efa81feb8405676e0136d97b10380179c92e0 upstream.

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: d3b6f23f7167 ("ext4: move ext4_fiemap to use iomap framework")
Reported-by: syzbot+77fa5bdb65cc39711820@syzkaller.appspotmail.com
Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20200505154324.3226743-2-hch@lst.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: George Kennedy <george.kennedy@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/ext4.h