diff options
author | Filipe Manana <fdmanana@suse.com> | 2014-10-27 13:44:24 +0300 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-10-27 23:16:52 +0300 |
commit | 1a4ed8fdca077d2489ec47d548451be69389e926 (patch) | |
tree | feee30ff76593fde7a28fa24a70dbbcc097c24a3 /fs/btrfs/tree-log.c | |
parent | 21e7626b12f25770e2975bc7c7b2e1d5b1d58a57 (diff) | |
download | linux-1a4ed8fdca077d2489ec47d548451be69389e926.tar.xz |
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>
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 2b26dad35d88..6d58d72705ae 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -672,7 +672,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans, * is this extent already allocated in the extent * allocation tree? If so, just add a reference */ - ret = btrfs_lookup_extent(root, ins.objectid, + ret = btrfs_lookup_data_extent(root, ins.objectid, ins.offset); if (ret == 0) { ret = btrfs_inc_extent_ref(trans, root, |