Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp674639img; Fri, 22 Mar 2019 06:21:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkrx8/92W8UN11/1QTb0J02v4Lf5rdvYVo4NmurOtRKHJDHP18R2TYkla6iPd2qwEJhTDU X-Received: by 2002:a63:f74c:: with SMTP id f12mr8832936pgk.124.1553260896833; Fri, 22 Mar 2019 06:21:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553260896; cv=none; d=google.com; s=arc-20160816; b=fKN5GpJ0VtEpjUPVL0bexirli8HTW9yfzC9tdxiy2kNJ28p9ws17HmtdtOOoNOvhaS GOQVl1PvcVl+7KpTYLkDMxerzdu7HM7m1+2QPtCms0LSbIf4nNNVwwkOvjCy0eyDl1tS +8oP+29uWhGJjxNGPgwijS4WTb7rLPgonCKg/wysllwCkeUcMmDZdSJKzcjqPLX5dRAC mv2MOMDBly7t0O4lDzT9jcpHtWvZGgQ5XzNMG7FwKBaGag7GNPzTiGADvR5k6QL+J+YG bgUl86MM0riBQnWREBLYCa0GVcm/IphFs4us1tiY027WtWNp4/GgkCT+0dllvBgwrX+V 6Zbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gCrFG6UaenWZK0Onl7RWm12v5ZG2dSwFG67zqywMo4E=; b=gIDpVAWCwmJPIYlt89wSBN39XsyTZzDTy2+jXYAzUAvdS12kLNDaZUuVeSniD+QiSE Io8t39Y+OQGZyl2lza00QDi1uzVWjv1TwdLIG9CiD6kmiAju6sMUYQcNyU9Kfzup5lxd 9eukMGbb4dIVOIc6V2EIJnNS16bOEU15s5mNFfaQxGV61yh1oROc1omMmoFEwPSc/SXQ q4FuLD7xdfZBJJJp2pzan3CGKw7tqGzUg/TDF7ZGeFlWNu9y22GBLSYaasidVLqwSdMc 5fcLqTANqAeD1rHO/LnSYcxHziAPlN+hVU/4qnnYSScH6FYh6dBRLIK9KsPBHdDNcxYY 0A6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="hYQ9/bXu"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h23si6711741pgv.190.2019.03.22.06.21.21; Fri, 22 Mar 2019 06:21:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="hYQ9/bXu"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728628AbfCVLVk (ORCPT + 99 others); Fri, 22 Mar 2019 07:21:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:48080 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728605AbfCVLVf (ORCPT ); Fri, 22 Mar 2019 07:21:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B2E16218A2; Fri, 22 Mar 2019 11:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253695; bh=jP94hG+MU/+ygDetenA6l7zWqPI0zcq0GIM7iv7ksmc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hYQ9/bXu/6qBEkPLc9M2i62GdFG3NQNTJwGAsnvwrZxkWJoqPhaRitvdus5aAlKqh HuBgaYmF68Mh+N+src5Am93Hx02w3EbnxJM+ggi5PWUZoGpIqGJGYkg+Mitxyi6CUr AUpKg2ahF2yk12n//EsmBSOA5C+I9bTAsFLaH1Zs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilya Dryomov , Sage Weil Subject: [PATCH 3.18 025/134] libceph: handle an empty authorize reply Date: Fri, 22 Mar 2019 12:13:58 +0100 Message-Id: <20190322111211.624715014@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ 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; + } } }