Commit 4b3576e4 authored by Zhaolei's avatar Zhaolei Committed by Chris Mason

btrfs: Error handle for get_ref_objectid_v0() in relocate_block_group()

We need error checking code for get_ref_objectid_v0() in
relocate_block_group(), to avoid unpredictable result, especially
for accessing uninitialized value(when function failed) after
this line.
Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarChris Mason <clm@fb.com>
parent 55e3a601
...@@ -3976,6 +3976,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) ...@@ -3976,6 +3976,10 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc)
sizeof(struct btrfs_extent_item_v0)); sizeof(struct btrfs_extent_item_v0));
ret = get_ref_objectid_v0(rc, path, &key, &ref_owner, ret = get_ref_objectid_v0(rc, path, &key, &ref_owner,
&path_change); &path_change);
if (ret < 0) {
err = ret;
break;
}
if (ref_owner < BTRFS_FIRST_FREE_OBJECTID) if (ref_owner < BTRFS_FIRST_FREE_OBJECTID)
flags = BTRFS_EXTENT_FLAG_TREE_BLOCK; flags = BTRFS_EXTENT_FLAG_TREE_BLOCK;
else else
......
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