summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorEryu Guan <guaneryu@gmail.com>2013-12-03 21:22:21 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-08 09:42:11 -0800
commita1192c0e5d037def6763f3873d3340615c241fe7 (patch)
tree6ea92f29388452b148f2a02c150f3b834c9dcabd /kernel
parent510e024d1e74bb0f574d14ee19436a56ed4fc476 (diff)
ext4: check for overlapping extents in ext4_valid_extent_entries()
commit 5946d089379a35dda0e531710b48fca05446a196 upstream. A corrupted ext4 may have out of order leaf extents, i.e. extent: lblk 0--1023, len 1024, pblk 9217, flags: LEAF UNINIT extent: lblk 1000--2047, len 1024, pblk 10241, flags: LEAF UNINIT ^^^^ overlap with previous extent Reading such extent could hit BUG_ON() in ext4_es_cache_extent(). BUG_ON(end < lblk); The problem is that __read_extent_tree_block() tries to cache holes as well but assumes 'lblk' is greater than 'prev' and passes underflowed length to ext4_es_cache_extent(). Fix it by checking for overlapping extents in ext4_valid_extent_entries(). I hit this when fuzz testing ext4, and am able to reproduce it by modifying the on-disk extent by hand. Also add the check for (ee_block + len - 1) in ext4_valid_extent() to make sure the value is not overflow. Ran xfstests on patched ext4 and no regression. Cc: Lukáš Czerner <lczerner@redhat.com> 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>
Diffstat (limited to 'kernel')
0 files changed, 0 insertions, 0 deletions