aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorEmil Goode <emilgoode@gmail.com>2013-05-28 10:59:00 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-09 15:24:24 -0500
commitf1b6559cfa8c280249b52112223459b00dcdb6e9 (patch)
treeee23ea569316f9fadaba6dcee95935b68d94c102 /fs/ceph
parent3da8d9a6ae084d013bfe1b47c319380a91c7012a (diff)
ceph: improve error handling in ceph_mdsmap_decode
commit c213b50b7dcbf06abcfbf1e4eee5b76586718bd9 upstream. This patch makes the following improvements to the error handling in the ceph_mdsmap_decode function: - Add a NULL check for return value from kcalloc - Make use of the variable err Signed-off-by: Emil Goode <emilgoode@gmail.com> Signed-off-by: Sage Weil <sage@inktank.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/mdsmap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index 9278dec9e940..d4d38977dcbb 100644
--- a/fs/ceph/mdsmap.c
+++ b/fs/ceph/mdsmap.c
@@ -138,6 +138,8 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
138 m->m_info[mds].export_targets = 138 m->m_info[mds].export_targets =
139 kcalloc(num_export_targets, sizeof(u32), 139 kcalloc(num_export_targets, sizeof(u32),
140 GFP_NOFS); 140 GFP_NOFS);
141 if (m->m_info[mds].export_targets == NULL)
142 goto badmem;
141 for (j = 0; j < num_export_targets; j++) 143 for (j = 0; j < num_export_targets; j++)
142 m->m_info[mds].export_targets[j] = 144 m->m_info[mds].export_targets[j] =
143 ceph_decode_32(&pexport_targets); 145 ceph_decode_32(&pexport_targets);
@@ -170,7 +172,7 @@ bad:
170 DUMP_PREFIX_OFFSET, 16, 1, 172 DUMP_PREFIX_OFFSET, 16, 1,
171 start, end - start, true); 173 start, end - start, true);
172 ceph_mdsmap_destroy(m); 174 ceph_mdsmap_destroy(m);
173 return ERR_PTR(-EINVAL); 175 return ERR_PTR(err);
174} 176}
175 177
176void ceph_mdsmap_destroy(struct ceph_mdsmap *m) 178void ceph_mdsmap_destroy(struct ceph_mdsmap *m)