]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: fix potential null pointer dereference when sending ping 40246/head
authorMykola Golub <mgolub@suse.com>
Sat, 16 Jan 2021 05:00:09 +0000 (05:00 +0000)
committersinguliere <singuliere@autistici.org>
Fri, 19 Mar 2021 17:57:26 +0000 (18:57 +0100)
Fixes: https://tracker.ceph.com/issues/48821
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit 86576b09973b857ec2fe8195069e21812992db26)

src/osd/OSD.cc

index 18e7acecdb8b362dd3c6a1a0c383316cb6bcb63c..668ff851a9a6fe9e0db8372dc84c8959a6e390dd 100644 (file)
@@ -5794,6 +5794,11 @@ void OSD::heartbeat()
        i != heartbeat_peers.end();
        ++i) {
     int peer = i->first;
+    Session *s = static_cast<Session*>(i->second.con_back->get_priv().get());
+    if (!s) {
+      dout(30) << "heartbeat osd." << peer << " has no open con" << dendl;
+      continue;
+    }
     dout(30) << "heartbeat sending ping to osd." << peer << dendl;
 
     i->second.last_tx = now;
@@ -5804,7 +5809,6 @@ void OSD::heartbeat()
     if (i->second.hb_interval_start == utime_t())
       i->second.hb_interval_start = now;
 
-    Session *s = static_cast<Session*>(i->second.con_back->get_priv().get());
     std::optional<ceph::signedspan> delta_ub;
     s->stamps->sent_ping(&delta_ub);