From f6427a54ca2ccf37bb0235e0ea9cdaa53aaabc9f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 27 Feb 2019 15:20:25 +0100 Subject: [PATCH] 3.18-stable patches added patches: libceph-handle-an-empty-authorize-reply.patch --- ...ceph-handle-an-empty-authorize-reply.patch | 63 +++++++++++++++++++ queue-3.18/series | 1 + 2 files changed, 64 insertions(+) create mode 100644 queue-3.18/libceph-handle-an-empty-authorize-reply.patch diff --git a/queue-3.18/libceph-handle-an-empty-authorize-reply.patch b/queue-3.18/libceph-handle-an-empty-authorize-reply.patch new file mode 100644 index 00000000000..3797150ec80 --- /dev/null +++ b/queue-3.18/libceph-handle-an-empty-authorize-reply.patch @@ -0,0 +1,63 @@ +From 0fd3fd0a9bb0b02b6435bb7070e9f7b82a23f068 Mon Sep 17 00:00:00 2001 +From: Ilya Dryomov +Date: Tue, 5 Feb 2019 20:30:27 +0100 +Subject: libceph: handle an empty authorize reply + +From: Ilya Dryomov + +commit 0fd3fd0a9bb0b02b6435bb7070e9f7b82a23f068 upstream. + +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: 5c056fdc5b47 ("libceph: verify authorize reply on connect") +Link: https://tracker.ceph.com/issues/20164 +Signed-off-by: Ilya Dryomov +Reviewed-by: Sage Weil +[idryomov@gmail.com: backport to 4.4: extra arg, no CEPHX_V2] +Signed-off-by: Greg Kroah-Hartman + +--- + net/ceph/messenger.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +--- a/net/ceph/messenger.c ++++ b/net/ceph/messenger.c +@@ -1980,15 +1980,19 @@ static int process_connect(struct ceph_c + dout("process_connect on %p tag %d\n", con, (int)con->in_tag); + + if (con->auth_reply_buf) { ++ int len = le32_to_cpu(con->in_reply.authorizer_len); ++ + /* + * Any connection that defines ->get_authorizer() + * should also define ->verify_authorizer_reply(). + * See get_connect_authorizer(). + */ +- ret = con->ops->verify_authorizer_reply(con, 0); +- if (ret < 0) { +- con->error_msg = "bad authorize reply"; +- return ret; ++ if (len) { ++ ret = con->ops->verify_authorizer_reply(con, 0); ++ if (ret < 0) { ++ con->error_msg = "bad authorize reply"; ++ return ret; ++ } + } + } + diff --git a/queue-3.18/series b/queue-3.18/series index 6cdba458f36..b22fb54f2b6 100644 --- a/queue-3.18/series +++ b/queue-3.18/series @@ -22,3 +22,4 @@ net-packet-fix-4gb-buffer-limit-due-to-overflow-check.patch team-avoid-complex-list-operations-in-team_nl_cmd_options_set.patch sit-check-if-ipv6-enabled-before-calling-ip6_err_gen_icmpv6_unreach.patch netlink-trim-skb-to-alloc-size-to-avoid-msg_trunc.patch +libceph-handle-an-empty-authorize-reply.patch -- 2.47.2