[PATCH 1/3] 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 zhao...@cn.fujitsu.com --- fs/btrfs/relocation.c | 4 1 file changed, 4 insertions(+) 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 -- 1.8.5.1 -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] btrfs: Error handle for get_ref_objectid_v0() in relocate_block_group()
On Wed, Aug 05, 2015 at 06:00:02PM +0800, Zhao Lei wrote: 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 zhao...@cn.fujitsu.com Reviewed-by: David Sterba dste...@suse.com Are there even filesystems with v0 refs? -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 1/3] btrfs: Error handle for get_ref_objectid_v0() in relocate_block_group()
Hi, David Sterba -Original Message- From: David Sterba [mailto:dste...@suse.com] Sent: Thursday, August 06, 2015 1:03 AM To: Zhao Lei Cc: linux-btrfs@vger.kernel.org Subject: Re: [PATCH 1/3] btrfs: Error handle for get_ref_objectid_v0() in relocate_block_group() On Wed, Aug 05, 2015 at 06:00:02PM +0800, Zhao Lei wrote: 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 zhao...@cn.fujitsu.com Reviewed-by: David Sterba dste...@suse.com Thanks for review! Are there even filesystems with v0 refs? Rarely, I think. (Just a accidental found in debuging another problem) But for current code, we need hold correct code until we remove v0 refs support. Thanks Zhaolei -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html