From: Zhaolei Date: Wed, 5 Aug 2015 10:00:02 +0000 (+0800) Subject: btrfs: Error handle for get_ref_objectid_v0() in relocate_block_group() X-Git-Tag: v4.3-rc1~16^2~31 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b3576e450a1539492e26e2d7b1e2e69578c032e;p=profile%2Fcommon%2Fplatform%2Fkernel%2Flinux-artik7.git 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 Reviewed-by: David Sterba Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 52fe55a..1659c94 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