Commit 3e8f43a0 authored by Yan, Zheng's avatar Yan, Zheng Committed by Alex Elder

ceph: Fix oops when handling mdsmap that decreases max_mds

When i >= newmap->m_max_mds, ceph_mdsmap_get_addr(newmap, i) return
NULL. Passing NULL to memcmp() triggers oops.
Signed-off-by: default avatarYan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: default avatarSage Weil <sage@inktank.com>
parent 6e14b1a6
...@@ -2625,7 +2625,8 @@ static void check_new_map(struct ceph_mds_client *mdsc, ...@@ -2625,7 +2625,8 @@ static void check_new_map(struct ceph_mds_client *mdsc,
ceph_mdsmap_is_laggy(newmap, i) ? " (laggy)" : "", ceph_mdsmap_is_laggy(newmap, i) ? " (laggy)" : "",
session_state_name(s->s_state)); session_state_name(s->s_state));
if (memcmp(ceph_mdsmap_get_addr(oldmap, i), if (i >= newmap->m_max_mds ||
memcmp(ceph_mdsmap_get_addr(oldmap, i),
ceph_mdsmap_get_addr(newmap, i), ceph_mdsmap_get_addr(newmap, i),
sizeof(struct ceph_entity_addr))) { sizeof(struct ceph_entity_addr))) {
if (s->s_state == CEPH_MDS_SESSION_OPENING) { if (s->s_state == CEPH_MDS_SESSION_OPENING) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment