diff --git a/src/msg/async/ProtocolV1.cc b/src/msg/async/ProtocolV1.cc index ab4b526105f..0d71148ffbd 100644 --- a/src/msg/async/ProtocolV1.cc +++ b/src/msg/async/ProtocolV1.cc @@ -1933,6 +1933,13 @@ CtPtr ProtocolV1::handle_connect_message_2() { need_challenge ? &authorizer_challenge : nullptr) || !authorizer_valid) { connection->lock.lock(); + if (state != ACCEPTING_WAIT_CONNECT_MSG_AUTH) { + ldout(cct, 1) << __func__ + << " state changed while accept, it must be mark_down" + << dendl; + ceph_assert(state == CLOSED); + return _fault(); + } if (need_challenge && !had_challenge && authorizer_challenge) { ldout(cct, 10) << __func__ << ": challenging authorizer" << dendl; diff --git a/src/msg/async/ProtocolV2.cc b/src/msg/async/ProtocolV2.cc index 99b424e6dbc..526545d6ea8 100644 --- a/src/msg/async/ProtocolV2.cc +++ b/src/msg/async/ProtocolV2.cc @@ -1980,6 +1980,13 @@ CtPtr ProtocolV2::handle_connect_message_2() { need_challenge ? &authorizer_challenge : nullptr) || !authorizer_valid) { connection->lock.lock(); + if (state != ACCEPTING_WAIT_CONNECT_MSG_AUTH) { + ldout(cct, 1) << __func__ + << " state changed while accept, it must be mark_down" + << dendl; + ceph_assert(state == CLOSED); + return _fault(); + } if (need_challenge && !had_challenge && authorizer_challenge) { ldout(cct, 10) << __func__ << ": challenging authorizer" << dendl;