diff options
author | Zhaolei <zhaolei@cn.fujitsu.com> | 2015-08-05 12:00:02 +0200 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2015-08-09 16:07:13 +0200 |
commit | 4b3576e450a1539492e26e2d7b1e2e69578c032e (patch) | |
tree | 65615cbf03efaa0a1304180d2f1ae00008c23a9a /fs/btrfs | |
parent | btrfs: Fix data checksum error cause by replace with io-load. (diff) | |
download | linux-4b3576e450a1539492e26e2d7b1e2e69578c032e.tar.xz linux-4b3576e450a1539492e26e2d7b1e2e69578c032e.zip |
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: Zhao Lei <zhaolei@cn.fujitsu.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/relocation.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 52fe55ad11d6..1659c94f179c 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -3976,6 +3976,10 @@ restart: sizeof(struct btrfs_extent_item_v0)); ret = get_ref_objectid_v0(rc, path, &key, &ref_owner, &path_change); + if (ret < 0) { + err = ret; + break; + } if (ref_owner < BTRFS_FIRST_FREE_OBJECTID) flags = BTRFS_EXTENT_FLAG_TREE_BLOCK; else |