diff options
author | 2021-11-07 16:22:57 +0100 | |
---|---|---|
committer | 2021-11-25 00:09:26 -0600 | |
commit | f8fbfd85f5c95fff477a7c19f576725945891d0c (patch) | |
tree | 1e373eb3ba60179d0fdae97d7df7e794832cc17b /fs/ksmbd/smb2pdu.c | |
parent | Linux 5.16-rc2 (diff) | |
download | linux-f8fbfd85f5c95fff477a7c19f576725945891d0c.tar.gz linux-f8fbfd85f5c95fff477a7c19f576725945891d0c.tar.bz2 linux-f8fbfd85f5c95fff477a7c19f576725945891d0c.zip |
ksmbd: Fix an error handling path in 'smb2_sess_setup()'
All the error handling paths of 'smb2_sess_setup()' end to 'out_err'.
All but the new error handling path added by the commit given in the Fixes
tag below.
Fix this error handling path and branch to 'out_err' as well.
Fixes: 0d994cd482ee ("ksmbd: add buffer validation in session setup")
Cc: stable@vger.kernel.org # v5.15
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/ksmbd/smb2pdu.c')
-rw-r--r-- | fs/ksmbd/smb2pdu.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c index 121f8e8c70ac..7d2e8599dc27 100644 --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -1697,8 +1697,10 @@ int smb2_sess_setup(struct ksmbd_work *work) negblob_off = le16_to_cpu(req->SecurityBufferOffset); negblob_len = le16_to_cpu(req->SecurityBufferLength); if (negblob_off < offsetof(struct smb2_sess_setup_req, Buffer) || - negblob_len < offsetof(struct negotiate_message, NegotiateFlags)) - return -EINVAL; + negblob_len < offsetof(struct negotiate_message, NegotiateFlags)) { + rc = -EINVAL; + goto out_err; + } negblob = (struct negotiate_message *)((char *)&req->hdr.ProtocolId + negblob_off); |