Commit 046f264f authored by Yan, Zheng's avatar Yan, Zheng Committed by Chris Mason

Btrfs: Fix null dereference in relocation.c

Fix a potential null dereference in relocation.c
Signed-off-by: default avatarYan Zheng <zheng.yan@oracle.com>
Acked-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 058a457e
......@@ -784,16 +784,17 @@ struct backref_node *build_backref_tree(struct reloc_control *rc,
struct btrfs_extent_ref_v0 *ref0;
ref0 = btrfs_item_ptr(eb, path1->slots[0],
struct btrfs_extent_ref_v0);
root = find_tree_root(rc, eb, ref0);
if (!root->ref_cows)
cur->cowonly = 1;
if (key.objectid == key.offset) {
root = find_tree_root(rc, eb, ref0);
if (root && !should_ignore_root(root))
cur->root = root;
else
list_add(&cur->list, &useless);
break;
}
if (is_cowonly_root(btrfs_ref_root_v0(eb,
ref0)))
cur->cowonly = 1;
}
#else
BUG_ON(key.type == BTRFS_EXTENT_REF_V0_KEY);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment