提交 e251e288 编写于 作者: S Sage Weil

ceph: fix mdsmap decoding when multiple mds's are present

A misplaced sizeof() around namelen was throwing things off.
Signed-off-by: NSage Weil <sage@newdream.net>
上级 b28813a6
...@@ -85,28 +85,28 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end) ...@@ -85,28 +85,28 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end)
void *pexport_targets = NULL; void *pexport_targets = NULL;
ceph_decode_need(p, end, sizeof(addr) + 1 + sizeof(u32), bad); ceph_decode_need(p, end, sizeof(addr) + 1 + sizeof(u32), bad);
*p += sizeof(addr); /* skip addr key */ ceph_decode_copy(p, &addr, sizeof(addr));
ceph_decode_8(p, infoversion); ceph_decode_8(p, infoversion);
ceph_decode_32(p, namelen); /* skip mds name */ ceph_decode_32(p, namelen); /* skip mds name */
*p += namelen; *p += namelen;
ceph_decode_need(p, end, ceph_decode_need(p, end,
5*sizeof(u32) + sizeof(u64) + 4*sizeof(u32) + sizeof(u64) +
sizeof(addr) + sizeof(struct ceph_timespec), sizeof(addr) + sizeof(struct ceph_timespec),
bad); bad);
ceph_decode_32(p, mds); ceph_decode_32(p, mds);
ceph_decode_32(p, inc); ceph_decode_32(p, inc);
ceph_decode_32(p, state); ceph_decode_32(p, state);
ceph_decode_64(p, state_seq); ceph_decode_64(p, state_seq);
ceph_decode_copy(p, &addr, sizeof(addr)); *p += sizeof(addr);
*p += sizeof(struct ceph_timespec); *p += sizeof(struct ceph_timespec);
*p += sizeof(u32); *p += sizeof(u32);
ceph_decode_32_safe(p, end, namelen, bad); ceph_decode_32_safe(p, end, namelen, bad);
*p += sizeof(namelen); *p += namelen;
if (infoversion >= 2) { if (infoversion >= 2) {
ceph_decode_32_safe(p, end, num_export_targets, bad); ceph_decode_32_safe(p, end, num_export_targets, bad);
pexport_targets = *p; pexport_targets = *p;
*p += sizeof(num_export_targets * sizeof(u32)); *p += num_export_targets * sizeof(u32);
} else { } else {
num_export_targets = 0; num_export_targets = 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册