From: Mykola Golub Date: Sat, 16 Jan 2021 05:00:09 +0000 (+0000) Subject: osd: fix potential null pointer dereference when sending ping X-Git-Tag: v15.2.13~13^2~8^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F40277%2Fhead;p=ceph.git osd: fix potential null pointer dereference when sending ping Fixes: https://tracker.ceph.com/issues/48821 Signed-off-by: Mykola Golub (cherry picked from commit 86576b09973b857ec2fe8195069e21812992db26) --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 34dd356ebf6e..076c255bd835 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -5680,6 +5680,11 @@ void OSD::heartbeat() i != heartbeat_peers.end(); ++i) { int peer = i->first; + Session *s = static_cast(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; @@ -5690,7 +5695,6 @@ void OSD::heartbeat() if (i->second.hb_interval_start == utime_t()) i->second.hb_interval_start = now; - Session *s = static_cast(i->second.con_back->get_priv().get()); std::optional delta_ub; s->stamps->sent_ping(&delta_ub);