summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEryu Guan <guaneryu@gmail.com>2015-05-14 19:00:45 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-06-05 23:19:58 -0700
commit566831a12ef80b9622bf8263299d859bdd35128c (patch)
tree9c3dd852d16b8f592cfce560dea0d043ea6c15d7
parent4379534c0d1131fabc7b4482943774a58233335a (diff)
ext4: check for zero length extent explicitly
commit 2f974865ffdfe7b9f46a9940836c8b167342563d upstream. The following commit introduced a bug when checking for zero length extent 5946d08 ext4: check for overlapping extents in ext4_valid_extent_entries() Zero length extent could pass the check if lblock is zero. Adding the explicit check for zero length back. Signed-off-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/ext4/extents.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 7fbd1c5b74af..df633bb25909 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -363,7 +363,7 @@ static int ext4_valid_extent(struct inode *inode, struct ext4_extent *ext)
ext4_lblk_t lblock = le32_to_cpu(ext->ee_block);
ext4_lblk_t last = lblock + len - 1;
- if (lblock > last)
+ if (len == 0 || lblock > last)
return 0;
return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
}