Skip to content

Commit

Permalink
ceph: Fix oops when handling mdsmap that decreases max_mds
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yan, Zheng authored and Alex Elder committed Oct 1, 2012
1 parent 6e14b1a commit 3e8f43a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/ceph/mds_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -2625,7 +2625,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) {
Expand Down

0 comments on commit 3e8f43a

Please sign in to comment.