1 From 2f974865ffdfe7b9f46a9940836c8b167342563d Mon Sep 17 00:00:00 2001
2 From: Eryu Guan <guaneryu@gmail.com>
3 Date: Thu, 14 May 2015 19:00:45 -0400
4 Subject: ext4: check for zero length extent explicitly
6 From: Eryu Guan <guaneryu@gmail.com>
8 commit 2f974865ffdfe7b9f46a9940836c8b167342563d upstream.
10 The following commit introduced a bug when checking for zero length extent
12 5946d08 ext4: check for overlapping extents in ext4_valid_extent_entries()
14 Zero length extent could pass the check if lblock is zero.
16 Adding the explicit check for zero length back.
18 Signed-off-by: Eryu Guan <guaneryu@gmail.com>
19 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23 fs/ext4/extents.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
26 --- a/fs/ext4/extents.c
27 +++ b/fs/ext4/extents.c
28 @@ -361,7 +361,7 @@ static int ext4_valid_extent(struct inod
29 ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
30 ext4_lblk_t last = lblock + len - 1;
33 + if (len == 0 || lblock > last)
35 return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);