Skip to content

Commit f8fbfd8

Browse files
tititiou36Steve French
authored andcommitted
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: 0d994cd ("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>
1 parent 1360572 commit f8fbfd8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/ksmbd/smb2pdu.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,8 +1697,10 @@ int smb2_sess_setup(struct ksmbd_work *work)
16971697
negblob_off = le16_to_cpu(req->SecurityBufferOffset);
16981698
negblob_len = le16_to_cpu(req->SecurityBufferLength);
16991699
if (negblob_off < offsetof(struct smb2_sess_setup_req, Buffer) ||
1700-
negblob_len < offsetof(struct negotiate_message, NegotiateFlags))
1701-
return -EINVAL;
1700+
negblob_len < offsetof(struct negotiate_message, NegotiateFlags)) {
1701+
rc = -EINVAL;
1702+
goto out_err;
1703+
}
17021704

17031705
negblob = (struct negotiate_message *)((char *)&req->hdr.ProtocolId +
17041706
negblob_off);

0 commit comments

Comments
 (0)