From patchwork Wed Aug 1 19:03:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 10552837 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A90B013BF for ; Wed, 1 Aug 2018 19:04:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A91ED2BA07 for ; Wed, 1 Aug 2018 19:04:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D8392BACC; Wed, 1 Aug 2018 19:04:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 568832BA07 for ; Wed, 1 Aug 2018 19:04:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387612AbeHAUvg (ORCPT ); Wed, 1 Aug 2018 16:51:36 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41252 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387539AbeHAUvg (ORCPT ); Wed, 1 Aug 2018 16:51:36 -0400 Received: by mail-wr1-f67.google.com with SMTP id j5-v6so21177529wrr.8 for ; Wed, 01 Aug 2018 12:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=TkERmVhayifiXR4zhpqepbdDezOAJwv9sGrmXt9SeDA=; b=jHPHIhop/bH6XXIRWl8cydK/eeo9KA/i/m/RtBuv17haJl2hTaWp19mTRwG/BxSmUb MfudVPNphJzMSLpsAQoA0z3f/6yhcnZAin0JyrhOLtsK2mfOg1kMBqbgNa/I1PVtCVLD EaVv9l+AOAh3NsCV6jXSQzXvtVgl1uPMaBTTrVaDbsN2CfHXZTl9OrpRCjSg2CeuGwWb JB+9ZyXec4OoUcX9W0SF8pVP5mIxHXLPwXFIaMUAiQ5jKkP8RvIPVJDeUNv/71ElqbCg HE//nvN10RgOgLDliKMd31Z/sFcKkTJFdwXAVCe/rnNTch8iTwNNQFK1juYqgx76FnEq IDIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=TkERmVhayifiXR4zhpqepbdDezOAJwv9sGrmXt9SeDA=; b=el/qL7cZB6nKQfPz7MKXssA+ANhFyyl756N2j8O8netmtGGzOlANW1gwjYQzk+FKsU CUeGK6MS+FBYrN7Ex/3d9aFPro5xnaSwynRtUroc77RJrdRv4iwNaeSU7RR7+VepyBJQ 2dxc6s0JOMrCTBJa1QQcUfA9Qs8vcoZ+K+86Jme0c+orQuImx10ttoUa6pKpxNtPGelO wGqUo0PGWDJtGlq9eMSbgbhpazvCYyjBaFxdGUbpPqSeZe9NcOBHA+rehWrZwZirQISA 8izezHNlQdCcSNHER9McUlTNARlvtfaR8/rbJColLdnm3YUoMSyQgdQAEfoEw8s6O+W7 bi2Q== X-Gm-Message-State: AOUpUlF3Xvv/j6gbiEAa4+wP0UuW+P1Z8NtrWs5zBSlSC1mxi3ortbRZ cQP+kbaSaUOjAiTNtaGYulwuEpNG X-Google-Smtp-Source: AAOMgpc23lOsm7m2bfSjbqwwDK6PWq8OcjBdWmxxC46QyrAWi6NOb7/Q8X22OoJDERJmoWx/HVeUvQ== X-Received: by 2002:adf:a541:: with SMTP id j1-v6mr26695023wrb.155.1533150262597; Wed, 01 Aug 2018 12:04:22 -0700 (PDT) Received: from orange.redhat.com ([213.175.37.12]) by smtp.gmail.com with ESMTPSA id r17-v6sm15401322wrt.44.2018.08.01.12.04.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Aug 2018 12:04:22 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 8/8] libceph: weaken sizeof check in ceph_x_verify_authorizer_reply() Date: Wed, 1 Aug 2018 21:03:50 +0200 Message-Id: <20180801190350.857-9-idryomov@gmail.com> X-Mailer: git-send-email 2.14.4 In-Reply-To: <20180801190350.857-1-idryomov@gmail.com> References: <20180801190350.857-1-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allow for extending ceph_x_authorize_reply in the future. Signed-off-by: Ilya Dryomov --- net/ceph/auth_x.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index 462786f571e7..b52732337ca6 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c @@ -737,8 +737,10 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, ret = ceph_x_decrypt(&au->session_key, &p, p + CEPHX_AU_ENC_BUF_LEN); if (ret < 0) return ret; - if (ret != sizeof(*reply)) - return -EPERM; + if (ret < sizeof(*reply)) { + pr_err("bad size %d for ceph_x_authorize_reply\n", ret); + return -EINVAL; + } if (au->nonce + 1 != le64_to_cpu(reply->nonce_plus_one)) ret = -EPERM;