From patchwork Tue Oct 4 06:23:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 12997964 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E3EFC433F5 for ; Tue, 4 Oct 2022 06:24:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229680AbiJDGYn (ORCPT ); Tue, 4 Oct 2022 02:24:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229489AbiJDGYm (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 DD4741120; Mon, 3 Oct 2022 23:24:38 -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 037C0660225F; Tue, 4 Oct 2022 07:24:34 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1664864677; bh=e7N33XmmW7DJXwdVzcj7bT09AaYcxc7AS55NGR1APok=; h=From:To:Cc:Subject:Date:From; b=jw/oCwLcKbVwJb24RT2XEeOQkE80heVoZsJoWzwUFbWARHXH+VzQL3lp7cFYjXo0L Ami50vmN1nhLy103aTWy4uqEyJNnQtx4PJqyAHWHiNbck7uX9eGoBV3tIaxx5frDlN tI3bV02fFATt+1F8qjNcPQT6vgH874VOehWH6YYtAWh248AgcjoXZ5daWBY7hXAaKd DUcDDJlAeNmWsPPgKdrhYrmaxQu75CHSNf/G+fRd312j8Cid2LkFw2pT6YmM1oA5D8 WPEmMZrZTaBHsfZrKe6JxBrprfpnZ0cb5F+dCQz+LOjLpp36CRRwGtmyrgVv++qhVQ POBS/BhDIZzZg== 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 1/2] cifs: remove initialization value Date: Tue, 4 Oct 2022 11:23:32 +0500 Message-Id: <20221004062333.416225-1-usama.anjum@collabora.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org Don't initialize the rc as its value is being overwritten before its use. Signed-off-by: Muhammad Usama Anjum Reviewed-by: Paulo Alcantara (SUSE) --- fs/cifs/smb2pdu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index 0600f0a07628..2bf43c892ae6 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -879,7 +879,7 @@ SMB2_negotiate(const unsigned int xid, struct smb2_negotiate_rsp *rsp; struct kvec iov[1]; struct kvec rsp_iov; - int rc = 0; + int rc; int resp_buftype; int blob_offset, blob_length; char *security_blob; From patchwork Tue Oct 4 06:23:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muhammad Usama Anjum X-Patchwork-Id: 12997965 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7B24C4332F for ; Tue, 4 Oct 2022 06:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229687AbiJDGYo (ORCPT ); Tue, 4 Oct 2022 02:24:44 -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 Precedence: bulk List-ID: X-Mailing-List: linux-cifs@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 (*),