diff options
author | Yan, Zheng <zheng.z.yan@intel.com> | 2012-09-20 05:42:25 -0400 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2012-10-01 15:30:54 -0400 |
commit | 3e8f43a089f06279c5f76a9ccd42578eebf7bfa5 (patch) | |
tree | 5b208f18d8a3031b21ed379bca471dbf2fdb0e47 /fs | |
parent | 6e14b1a6c3b8d7e48ece68733d2dac0464611ee4 (diff) |
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: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/mds_client.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index a5a735422aa7..1bcf712655d9 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -2625,7 +2625,8 @@ static void check_new_map(struct ceph_mds_client *mdsc, | |||
2625 | ceph_mdsmap_is_laggy(newmap, i) ? " (laggy)" : "", | 2625 | ceph_mdsmap_is_laggy(newmap, i) ? " (laggy)" : "", |
2626 | session_state_name(s->s_state)); | 2626 | session_state_name(s->s_state)); |
2627 | 2627 | ||
2628 | if (memcmp(ceph_mdsmap_get_addr(oldmap, i), | 2628 | if (i >= newmap->m_max_mds || |
2629 | memcmp(ceph_mdsmap_get_addr(oldmap, i), | ||
2629 | ceph_mdsmap_get_addr(newmap, i), | 2630 | ceph_mdsmap_get_addr(newmap, i), |
2630 | sizeof(struct ceph_entity_addr))) { | 2631 | sizeof(struct ceph_entity_addr))) { |
2631 | if (s->s_state == CEPH_MDS_SESSION_OPENING) { | 2632 | if (s->s_state == CEPH_MDS_SESSION_OPENING) { |