From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Steve French <sfrench@samba.org>, Paulo Alcantara <pc@cjr.nz>,
Ronnie Sahlberg <lsahlber@redhat.com>,
Shyam Prasad N <sprasad@microsoft.com>,
Tom Talpey <tom@talpey.com>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
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 [thread overview]
Message-ID: <20221004062333.416225-2-usama.anjum@collabora.com> (raw)
In-Reply-To: <20221004062333.416225-1-usama.anjum@collabora.com>
smb311_decode_neg_context() can return error. Its return value should be
checked for errors.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
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
next prev parent reply other threads:[~2022-10-04 6:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-04 6:23 [PATCH 1/2] cifs: remove initialization value Muhammad Usama Anjum
2022-10-04 6:23 ` Muhammad Usama Anjum [this message]
2022-10-04 19:01 ` [PATCH 2/2] cifs: check returned value for error Paulo Alcantara
2022-10-05 5:17 ` Muhammad Usama Anjum
2022-10-04 14:23 ` [PATCH 1/2] cifs: remove initialization value Enzo Matsumiya
2022-10-05 14:13 ` David Laight
2022-10-07 19:22 ` 'Enzo Matsumiya'
2022-10-05 14:58 ` Dan Carpenter
2022-10-04 18:59 ` Paulo Alcantara
2022-10-05 7:05 ` Steve French
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221004062333.416225-2-usama.anjum@collabora.com \
--to=usama.anjum@collabora.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kernel@collabora.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lsahlber@redhat.com \
--cc=pc@cjr.nz \
--cc=samba-technical@lists.samba.org \
--cc=sfrench@samba.org \
--cc=sprasad@microsoft.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox