]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix potential access violation during handling PING_REPLY 8995/head
authorxie xingguo <xie.xingguo@zte.com.cn>
Mon, 9 May 2016 11:51:55 +0000 (19:51 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Mon, 9 May 2016 12:34:06 +0000 (20:34 +0800)
Need to make sure i != heartbeat_peers.end() before dereferencing it.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/osd/OSD.cc

index 7caef4ef946e1a59250d8c58ca7ec015a5fe4924..f5b8f5723f11a9c9b2ae783ab6712c8651a6786b 100644 (file)
@@ -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;