]> git.hungrycats.org Git - linux/commit
Btrfs: fix invalid leaf slot access in btrfs_lookup_extent()
authorFilipe Manana <fdmanana@suse.com>
Mon, 27 Oct 2014 10:44:24 +0000 (10:44 +0000)
committerZygo Blaxell <zblaxell@serenity.furryterror.org>
Fri, 23 Jan 2015 13:15:33 +0000 (08:15 -0500)
commit3093e174d49aa32c0fe28d69c38de1dd32c1330f
tree0a1fd50025f6d1704876d722206550444dfe5c44
parent49e8ad5355db233d3fba392182a7859581f8facc
Btrfs: fix invalid leaf slot access in btrfs_lookup_extent()

If we couldn't find our extent item, we accessed the current slot
(path->slots[0]) to check if it corresponds to an equivalent skinny
metadata item. However this slot could be beyond our last item in the
leaf (i.e. path->slots[0] >= btrfs_header_nritems(leaf)), in which case
we shouldn't process it.

Since btrfs_lookup_extent() is only used to find extent items for data
extents, fix this by removing completely the logic that looks up for an
equivalent skinny metadata item, since it can not exist.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
(cherry picked from commit 1a4ed8fdca077d2489ec47d548451be69389e926)
fs/btrfs/ctree.h
fs/btrfs/extent-tree.c
fs/btrfs/tree-log.c