From: xie xingguo Date: Mon, 9 May 2016 11:51:55 +0000 (+0800) Subject: osd: fix potential access violation during handling PING_REPLY X-Git-Tag: v11.0.0~576^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=b29daf05fdfe4920b9d6edd887e2d76a043fbfd6;p=ceph.git osd: fix potential access violation during handling PING_REPLY Need to make sure i != heartbeat_peers.end() before dereferencing it. Signed-off-by: xie xingguo --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 7caef4ef946e..f5b8f5723f11 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -3970,6 +3970,25 @@ void OSD::handle_osd_ping(MOSDPing *m) << dendl; i->second.last_rx_front = m->stamp; } + + utime_t cutoff = ceph_clock_now(cct); + cutoff -= cct->_conf->osd_heartbeat_grace; + if (i->second.is_healthy(cutoff)) { + // Cancel false reports + if (failure_queue.count(from)) { + dout(10) << "handle_osd_ping canceling queued " + << "failure report for osd." << from << dendl; + failure_queue.erase(from); + } + + if (failure_pending.count(from)) { + dout(10) << "handle_osd_ping canceling in-flight " + << "failure report for osd." << from << dendl; + send_still_alive(curmap->get_epoch(), + failure_pending[from].second); + failure_pending.erase(from); + } + } } if (m->map_epoch && @@ -3982,21 +4001,6 @@ void OSD::handle_osd_ping(MOSDPing *m) } } } - - utime_t cutoff = ceph_clock_now(cct); - cutoff -= cct->_conf->osd_heartbeat_grace; - if (i->second.is_healthy(cutoff)) { - // Cancel false reports - if (failure_queue.count(from)) { - dout(10) << "handle_osd_ping canceling queued failure report for osd." << from<< dendl; - failure_queue.erase(from); - } - if (failure_pending.count(from)) { - dout(10) << "handle_osd_ping canceling in-flight failure report for osd." << from<< dendl; - send_still_alive(curmap->get_epoch(), failure_pending[from].second); - failure_pending.erase(from); - } - } } break;