Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp38733rwb; Mon, 3 Oct 2022 23:42:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7SEM26P6BtCIjRbvmdG1C8Flk4OQIdWSOW78eM7mgitvgAcV5znP6XCHDCPjXuXrVJbTR4 X-Received: by 2002:a17:907:9812:b0:781:bbff:1d20 with SMTP id ji18-20020a170907981200b00781bbff1d20mr18054701ejc.33.1664865762642; Mon, 03 Oct 2022 23:42:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664865762; cv=none; d=google.com; s=arc-20160816; b=Z5JC7S2I3l5YvksZ4///q644XhXqyEZ43gCiXU7BRplDNEJ2A68PpXrAOM1/pgEUCn KS9tUB/5fdfrsE9LxnEBTU/HJsRVqo/2uJUXKE3OnVxrYGNOY3iupHVQaPgUILIFuE3S 56Oyk93rY+TKvVZSaDAqRtWUCChcpF2zJkTXQ8loKKEacXfjRX9pKEA/j6dRR+z6pGVD aUXbYpBnXMahDV/0AuC8fjmpsg3MQiuyXfLjmDiWJqzzaLjjSM60D58MsUszjeRcK7Ez wlYM8PiH+FUO4q0/U+Oxh3hMS3W+ktXPbM6SPkHnmCH6IFFGasAs8a4XyVdaeNxQJkL9 fB5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=mZS7/WhLoAqWZrm/JVVevOLX8KI54GtVOMqFmUqZLq4=; b=sUjMwsBykQov2ua2Wd1dp2C+cjM89FpK+a7/vTyguSKuEtrjft5X8/rG+vgGe8xVsR LLDrloVOOwD4ptvutH+fNeReoXvHhMxRlhDH+2gD6r6pP6PNcFqC3wShRfe+V7lUJMOV PPWnG9tjweRfw6V8AuPxr3kxA2koi2x9e23jybxNRHEd6Y5LADKIm0N5dPAzyH4ii5C3 Paio6U8Wytj/3QlG+Ay1QB97Y5KH+N5qNblvd9b3H7mdWbx4PAC3XfImnoVzMqr0zBYS 72lH6LMlTBSQj2yjvN5/99BYW+ElKRelzAj/iL8EpdLQQ6foCQnR01BU9zY+s+ITtmwH 0daw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CEnZSOFo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v5-20020a056402348500b00453bc1fda81si11579860edc.556.2022.10.03.23.42.14; Mon, 03 Oct 2022 23:42:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=CEnZSOFo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbiJDGYt (ORCPT + 99 others); Tue, 4 Oct 2022 02:24:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229677AbiJDGYm (ORCPT ); Tue, 4 Oct 2022 02:24:42 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8452F2ACE; Mon, 3 Oct 2022 23:24:41 -0700 (PDT) Received: from lenovo.Home (unknown [39.45.148.204]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: usama.anjum) by madras.collabora.co.uk (Postfix) with ESMTPSA id 0C351660226B; Tue, 4 Oct 2022 07:24:37 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1664864680; bh=nsD45MICY1/StpyRVxzsvj75lhf0v0C421rqzuUFNa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CEnZSOFoQ2rnZp7yXzHzzaqbX7xsDO5IUpE35W2lVt65jBHeiyKmRZ2CmskD0Zhee 0CndLFDxCMO8jXVKgYX9isnMY42PrJyktpyNIV28Tpi2qr4JW1D3A+3PpFCFrFBUCi wUxO5TufnwWktwIIPITbA4v2Z7T556mLJqtfjOYaeNthSQuZIVO3FOjUyGhMwLKkiZ OPD1acL16lv8wnoeemwpR4X1/3vAL4yQQPWtDrvPxwoNLDu2iBcmQOhUZS/Hr+RXyX R257m1Vc+H5BH4s91sb2eKkzq4q/PQbEpuWN1tZYP4iDrBLXsqoJhkDC335DB4bcYj dPPB4RiVCwuiA== From: Muhammad Usama Anjum To: Steve French , Paulo Alcantara , Ronnie Sahlberg , Shyam Prasad N , Tom Talpey Cc: Muhammad Usama Anjum , kernel@collabora.com, kernel-janitors@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] cifs: check returned value for error Date: Tue, 4 Oct 2022 11:23:33 +0500 Message-Id: <20221004062333.416225-2-usama.anjum@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221004062333.416225-1-usama.anjum@collabora.com> References: <20221004062333.416225-1-usama.anjum@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org smb311_decode_neg_context() can return error. Its return value should be checked for errors. Signed-off-by: Muhammad Usama Anjum --- fs/cifs/smb2pdu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 2bf43c892ae6..c6e37352dbe1 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1089,11 +1089,14 @@ SMB2_negotiate(const unsigned int xid, server->signing_algorithm = SIGNING_ALG_AES_CMAC; server->signing_negotiated = false; - if (rsp->NegotiateContextCount) + if (rsp->NegotiateContextCount) { rc = smb311_decode_neg_context(rsp, server, rsp_iov.iov_len); - else + if (rc) + goto neg_exit; + } else { cifs_server_dbg(VFS, "Missing expected negotiate contexts\n"); + } /* * Some servers will not send a SMB2_SIGNING_CAPABILITIES context response (*), -- 2.30.2