From patchwork Tue May 23 16:33:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9743035 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BC3C260380 for ; Tue, 23 May 2017 16:34:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B0072286B8 for ; Tue, 23 May 2017 16:34:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4F8C287DC; Tue, 23 May 2017 16:34:28 +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=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 56FA5286B8 for ; Tue, 23 May 2017 16:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933184AbdEWQe0 (ORCPT ); Tue, 23 May 2017 12:34:26 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:35972 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935721AbdEWQeP (ORCPT ); Tue, 23 May 2017 12:34:15 -0400 Received: by mail-qk0-f196.google.com with SMTP id y128so23471582qka.3 for ; Tue, 23 May 2017 09:34:15 -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=rrkFK6Cb1mPHCHuc8ZJAUu5M8d0fHeJwZU/A8bb1Qsc=; b=dUo4+T8ByUk0Mr/sFNJLZ/yomSCw043Iiw5TyCk+AoCrqqjDfMSpNapmKvSyjVb/kw tnLo64eFMuQn6DvRcxcbrXR/mYlaKXMwiP8yf9B91uQmwfZsVFbaWI5wKtxVBp0UaEqy MDLXUbkt1K9GmEmb79eRAGJwJaT8kU6m1ZdVhs7qAtgGAvFAIAKYeJIdhRe+IWSMh07v DOko5LS+V9IlF6KZBIUKY4mYN/9z+wer+a/XaAPew84Kvj9PIL2ceHYchcTIgW9sWYg4 /vEgp3b+jV2o7F14XzUkjc8PJJQpZ6U/cwh6caR/DkUbgb3f988kUxJ41qPObGeFdExn gt4g== 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=rrkFK6Cb1mPHCHuc8ZJAUu5M8d0fHeJwZU/A8bb1Qsc=; b=PaHHzF63dDEjlOBTfI8uEasCpn/4y1tE7yhvfkoo29ZUVvoaI7sMpnpWFRU49u2THD NKfev1ExycXTmc2CDxA1x4EEcYOwG95GcD1Aj+Q5QUbH7q39pyFjXSH+C3wTXr5GMPsi aIUVE+CAlcEVOZ3UJD9c3SO2cvROVr7kmHsMjQegeZo/qte+Sf4tnLY55NDOmrS5dpxu XYETiqJNUnR1MqavsqHINwOcyI2q2L8zhgTYY7rU5B6OOnXfVRCo9Gk8fO9W91KFNsjD /JWAjU4lk4RV74+Leh8v8lXudVeYgilEl/pcrtY2dtR+9p4vW/i5Ps6g5HOUnq0Byrre 1vqg== X-Gm-Message-State: AODbwcCMvxnGl7YIKZrbiXYAe6/QCSiuEW9It1GbXOfQ44ygDU/jl8nP ICoF8Evm9fu+DW08gX0= X-Received: by 10.55.95.5 with SMTP id t5mr28970709qkb.64.1495557254654; Tue, 23 May 2017 09:34:14 -0700 (PDT) Received: from orange.brq.redhat.com. (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id o15sm784055qki.47.2017.05.23.09.34.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 09:34:14 -0700 (PDT) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 4/5] libceph: validate blob_struct_v in process_one_ticket() Date: Tue, 23 May 2017 18:33:57 +0200 Message-Id: <1495557238-1077-5-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1495557238-1077-1-git-send-email-idryomov@gmail.com> References: <1495557238-1077-1-git-send-email-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 None of these are validated in userspace, but since we do validate reply_struct_v in ceph_x_proc_ticket_reply(), tkt_struct_v (first) and CephXServiceTicket struct_v (second) in process_one_ticket(), validate CephXTicketBlob struct_v as well. Signed-off-by: Ilya Dryomov Reviewed-by: Alex Elder --- net/ceph/auth_x.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index 2034fb926670..d0126df33f1f 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c @@ -215,6 +215,9 @@ static int process_one_ticket(struct ceph_auth_client *ac, dout(" ticket blob is %d bytes\n", dlen); ceph_decode_need(ptp, tpend, 1 + sizeof(u64), bad); blob_struct_v = ceph_decode_8(ptp); + if (blob_struct_v != 1) + goto bad; + new_secret_id = ceph_decode_64(ptp); ret = ceph_decode_buffer(&new_ticket_blob, ptp, tpend); if (ret)