summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2012-09-20 17:42:25 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-11-26 11:38:44 -0800
commit73bba6fc44591587254fec8e867a99b5a2a28ba7 (patch)
tree6bd5dd48eb63fc4ecffc5c1fe006ed2ef58fc2a9
parent631015e45ee3bdcde1fe75e7d04fdfece6e42016 (diff)
downloadlinux-3.10-73bba6fc44591587254fec8e867a99b5a2a28ba7.tar.gz
linux-3.10-73bba6fc44591587254fec8e867a99b5a2a28ba7.tar.bz2
linux-3.10-73bba6fc44591587254fec8e867a99b5a2a28ba7.zip
ceph: Fix oops when handling mdsmap that decreases max_mds
(cherry picked from commit 3e8f43a089f06279c5f76a9ccd42578eebf7bfa5) 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/ceph/mds_client.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 5ac6434185a..7f1682da29a 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -2634,7 +2634,8 @@ static void check_new_map(struct ceph_mds_client *mdsc,
ceph_mdsmap_is_laggy(newmap, i) ? " (laggy)" : "",
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),
sizeof(struct ceph_entity_addr))) {
if (s->s_state == CEPH_MDS_SESSION_OPENING) {