diff options
author | Joseph Qi <joseph.qi@huawei.com> | 2013-09-11 17:19:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 18:56:44 -0400 |
commit | 2b0f6eae2dd2f7f21dbf93241938a687f6757dea (patch) | |
tree | f74caa2c881af2da388114c94d6d9f9e268d8f4e | |
parent | 3d94ea51c1d8db6f41268a9d2aea5f5771e9a8d3 (diff) |
ocfs2: add missing return value check of ocfs2_get_clusters()
In ocfs2_attach_refcount_tree() and ocfs2_duplicate_extent_list(), if
error occurs when calling ocfs2_get_clusters(), it will go with
unexpected behavior as local variables p_cluster, num_clusters and
ext_flags are declared without initialization.
Signed-off-by: Joseph Qi <joseph.qi@huawei.com>
Reviewed-by: Jie Liu <jeff.liu@oracle.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ocfs2/refcounttree.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index a70d604593b6..bf4dfc14bb2c 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -3854,7 +3854,10 @@ static int ocfs2_attach_refcount_tree(struct inode *inode, | |||
3854 | while (cpos < clusters) { | 3854 | while (cpos < clusters) { |
3855 | ret = ocfs2_get_clusters(inode, cpos, &p_cluster, | 3855 | ret = ocfs2_get_clusters(inode, cpos, &p_cluster, |
3856 | &num_clusters, &ext_flags); | 3856 | &num_clusters, &ext_flags); |
3857 | 3857 | if (ret) { | |
3858 | mlog_errno(ret); | ||
3859 | goto unlock; | ||
3860 | } | ||
3858 | if (p_cluster && !(ext_flags & OCFS2_EXT_REFCOUNTED)) { | 3861 | if (p_cluster && !(ext_flags & OCFS2_EXT_REFCOUNTED)) { |
3859 | ret = ocfs2_add_refcount_flag(inode, &di_et, | 3862 | ret = ocfs2_add_refcount_flag(inode, &di_et, |
3860 | &ref_tree->rf_ci, | 3863 | &ref_tree->rf_ci, |
@@ -4025,7 +4028,10 @@ static int ocfs2_duplicate_extent_list(struct inode *s_inode, | |||
4025 | while (cpos < clusters) { | 4028 | while (cpos < clusters) { |
4026 | ret = ocfs2_get_clusters(s_inode, cpos, &p_cluster, | 4029 | ret = ocfs2_get_clusters(s_inode, cpos, &p_cluster, |
4027 | &num_clusters, &ext_flags); | 4030 | &num_clusters, &ext_flags); |
4028 | 4031 | if (ret) { | |
4032 | mlog_errno(ret); | ||
4033 | goto out; | ||
4034 | } | ||
4029 | if (p_cluster) { | 4035 | if (p_cluster) { |
4030 | ret = ocfs2_add_refcounted_extent(t_inode, &et, | 4036 | ret = ocfs2_add_refcounted_extent(t_inode, &et, |
4031 | ref_ci, ref_root_bh, | 4037 | ref_ci, ref_root_bh, |