Skip to content

Commit

Permalink
Merge pull request #16455 from liewegas/wip-20667
Browse files Browse the repository at this point in the history
osd,mds,mgr: do not dereference null rotating_keys

Reviewed-by: Bassam Tabbara <Bassam.Tabbara@Quantum.com>
  • Loading branch information
liewegas committed Jul 21, 2017
2 parents 9bd678e + 91548a3 commit 33daf6f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 18 deletions.
13 changes: 10 additions & 3 deletions src/mds/MDSDaemon.cc
Expand Up @@ -1267,9 +1267,16 @@ bool MDSDaemon::ms_verify_authorizer(Connection *con, int peer_type,
EntityName name;
uint64_t global_id;

is_valid = authorize_handler->verify_authorizer(
cct, monc->rotating_secrets.get(),
authorizer_data, authorizer_reply, name, global_id, caps_info, session_key);
RotatingKeyRing *keys = monc->rotating_secrets.get();
if (keys) {
is_valid = authorize_handler->verify_authorizer(
cct, keys,
authorizer_data, authorizer_reply, name, global_id, caps_info,
session_key);
} else {
dout(10) << __func__ << " no rotating_keys (yet), denied" << dendl;
is_valid = false;
}

if (is_valid) {
entity_name_t n(con->get_peer_type(), global_id);
Expand Down
18 changes: 12 additions & 6 deletions src/mgr/DaemonServer.cc
Expand Up @@ -148,12 +148,18 @@ bool DaemonServer::ms_verify_authorizer(Connection *con,
s->inst.addr = con->get_peer_addr();
AuthCapsInfo caps_info;

is_valid = handler->verify_authorizer(
cct, monc->rotating_secrets.get(),
authorizer_data,
authorizer_reply, s->entity_name,
s->global_id, caps_info,
session_key);
RotatingKeyRing *keys = monc->rotating_secrets.get();
if (keys) {
is_valid = handler->verify_authorizer(
cct, keys,
authorizer_data,
authorizer_reply, s->entity_name,
s->global_id, caps_info,
session_key);
} else {
dout(10) << __func__ << " no rotating_keys (yet), denied" << dendl;
is_valid = false;
}

if (is_valid) {
if (caps_info.allow_all) {
Expand Down
4 changes: 2 additions & 2 deletions src/msg/async/AsyncConnection.cc
Expand Up @@ -978,8 +978,8 @@ ssize_t AsyncConnection::_process_connection()
<< " - presumably this is the same node!" << dendl;
} else {
ldout(async_msgr->cct, 10) << __func__ << " connect claims to be "
<< paddr << " not " << peer_addr
<< " (peer is possibly using public_bind_addr?) " << dendl;
<< paddr << " not " << peer_addr << dendl;
goto fail;
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/msg/simple/Pipe.cc
Expand Up @@ -1090,8 +1090,8 @@ int Pipe::connect()
<< paddr << " not " << peer_addr << " - presumably this is the same node!" << dendl;
} else {
ldout(msgr->cct,10) << "connect claims to be "
<< paddr << " not " << peer_addr
<< " (peer is possibly using public_bind_addr?) " << dendl;
<< paddr << " not " << peer_addr << dendl;
goto fail;
}
}

Expand Down
20 changes: 15 additions & 5 deletions src/osd/OSD.cc
Expand Up @@ -4709,7 +4709,11 @@ void OSD::handle_osd_ping(MOSDPing *m)
}

OSDMapRef curmap = service.get_osdmap();
assert(curmap);
if (!curmap) {
heartbeat_lock.Unlock();
m->put();
return;
}

switch (m->op) {

Expand Down Expand Up @@ -6964,10 +6968,16 @@ bool OSD::ms_verify_authorizer(Connection *con, int peer_type,
uint64_t global_id;
uint64_t auid = CEPH_AUTH_UID_DEFAULT;

isvalid = authorize_handler->verify_authorizer(
cct, monc->rotating_secrets.get(),
authorizer_data, authorizer_reply, name, global_id, caps_info, session_key,
&auid);
RotatingKeyRing *keys = monc->rotating_secrets.get();
if (keys) {
isvalid = authorize_handler->verify_authorizer(
cct, keys,
authorizer_data, authorizer_reply, name, global_id, caps_info, session_key,
&auid);
} else {
dout(10) << __func__ << " no rotating_keys (yet), denied" << dendl;
isvalid = false;
}

if (isvalid) {
Session *s = static_cast<Session *>(con->get_priv());
Expand Down

0 comments on commit 33daf6f

Please sign in to comment.