FAILED: patch "[PATCH] ksmbd: Fix an error handling path in 'smb2_sess_setup()'" failed to apply to 5.15-stable tree
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f8fbfd85f5c95fff477a7c19f576725945891d0c Mon Sep 17 00:00:00 2001
From: Christophe JAILLET <[email protected]>
Date: Sun, 7 Nov 2021 16:22:57 +0100
Subject: [PATCH] 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 [email protected] # v5.15
Acked-by Namjae Jeon <[email protected]>
Signed-off-by Christophe JAILLET <[email protected]>
Signed-off-by Steve French <[email protected]>
fs/ksmbd/smb2pdu.c +4 -2
@@ -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);