]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.14.44/ext4-check-for-zero-length-extent-explicitly.patch
drop queue-4.14/mips-make-sure-dt-memory-regions-are-valid.patch
[thirdparty/kernel/stable-queue.git] / releases / 3.14.44 / ext4-check-for-zero-length-extent-explicitly.patch
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
5
6 From: Eryu Guan <guaneryu@gmail.com>
7
8 commit 2f974865ffdfe7b9f46a9940836c8b167342563d upstream.
9
10 The following commit introduced a bug when checking for zero length extent
11
12 5946d08 ext4: check for overlapping extents in ext4_valid_extent_entries()
13
14 Zero length extent could pass the check if lblock is zero.
15
16 Adding the explicit check for zero length back.
17
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>
21
22 ---
23 fs/ext4/extents.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
25
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;
31
32 - if (lblock > last)
33 + if (len == 0 || lblock > last)
34 return 0;
35 return ext4_data_block_valid(EXT4_SB(inode->i_sb), block, len);
36 }