libceph: handle an empty authorize reply
The authorize reply can be empty, for example when the ticket used to
build the authorizer is too old and TAG_BADAUTHORIZER is returned from
the service. Calling ->verify_authorizer_reply() results in an attempt
to decrypt and validate (somewhat) random data in au->buf (most likely
the signature block from calc_signature()), which fails and ends up in
con_fault_finish() with !con->auth_retry. The ticket isn't invalidated
and the connection is retried again and again until a new ticket is
obtained from the monitor:
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
libceph: osd2 192.168.122.1:6809 bad authorize reply
Let TAG_BADAUTHORIZER handler kick in and increment con->auth_retry.
Cc: stable@vger.kernel.org
Fixes: 5c056fdc5b
("libceph: verify authorize reply on connect")
Link: https://tracker.ceph.com/issues/20164
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Родитель
a3b22b9f11
Коммит
0fd3fd0a9b
|
@ -2058,6 +2058,8 @@ static int process_connect(struct ceph_connection *con)
|
||||||
dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
|
dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
|
||||||
|
|
||||||
if (con->auth) {
|
if (con->auth) {
|
||||||
|
int len = le32_to_cpu(con->in_reply.authorizer_len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Any connection that defines ->get_authorizer()
|
* Any connection that defines ->get_authorizer()
|
||||||
* should also define ->add_authorizer_challenge() and
|
* should also define ->add_authorizer_challenge() and
|
||||||
|
@ -2067,8 +2069,7 @@ static int process_connect(struct ceph_connection *con)
|
||||||
*/
|
*/
|
||||||
if (con->in_reply.tag == CEPH_MSGR_TAG_CHALLENGE_AUTHORIZER) {
|
if (con->in_reply.tag == CEPH_MSGR_TAG_CHALLENGE_AUTHORIZER) {
|
||||||
ret = con->ops->add_authorizer_challenge(
|
ret = con->ops->add_authorizer_challenge(
|
||||||
con, con->auth->authorizer_reply_buf,
|
con, con->auth->authorizer_reply_buf, len);
|
||||||
le32_to_cpu(con->in_reply.authorizer_len));
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -2078,12 +2079,14 @@ static int process_connect(struct ceph_connection *con)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (len) {
|
||||||
ret = con->ops->verify_authorizer_reply(con);
|
ret = con->ops->verify_authorizer_reply(con);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
con->error_msg = "bad authorize reply";
|
con->error_msg = "bad authorize reply";
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (con->in_reply.tag) {
|
switch (con->in_reply.tag) {
|
||||||
case CEPH_MSGR_TAG_FEATURES:
|
case CEPH_MSGR_TAG_FEATURES:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче