summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/tree-log.c
diff options
context:
space:
mode:
authorFilipe Manana2014-10-27 11:44:24 +0100
committerChris Mason2014-10-27 21:16:52 +0100
commit1a4ed8fdca077d2489ec47d548451be69389e926 (patch)
treefeee30ff76593fde7a28fa24a70dbbcc097c24a3 /fs/btrfs/tree-log.c
parentbtrfs: use macro accessors in superblock validation checks (diff)
downloadkernel-qcow2-linux-1a4ed8fdca077d2489ec47d548451be69389e926.tar.gz
kernel-qcow2-linux-1a4ed8fdca077d2489ec47d548451be69389e926.tar.xz
kernel-qcow2-linux-1a4ed8fdca077d2489ec47d548451be69389e926.zip
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.c2
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,