linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ksmbd: Fix an error handling path in 'smb2_sess_setup()'
@ 2021-11-07 15:22 Christophe JAILLET
  2021-11-07 20:33 ` Namjae Jeon
  0 siblings, 1 reply; 2+ messages in thread
From: Christophe JAILLET @ 2021-11-07 15:22 UTC (permalink / raw)
  To: linkinjeon, senozhatsky, sfrench, hyc.lee, mmakassikis
  Cc: linux-cifs, linux-kernel, kernel-janitors, Christophe JAILLET

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")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 fs/ksmbd/smb2pdu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index ba68a27cabf8..bb0d1b155b34 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -1698,8 +1698,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);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ksmbd: Fix an error handling path in 'smb2_sess_setup()'
  2021-11-07 15:22 [PATCH] ksmbd: Fix an error handling path in 'smb2_sess_setup()' Christophe JAILLET
@ 2021-11-07 20:33 ` Namjae Jeon
  0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2021-11-07 20:33 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: senozhatsky, sfrench, hyc.lee, mmakassikis, linux-cifs,
	linux-kernel, kernel-janitors, stable

2021-11-08 0:22 GMT+09:00, Christophe JAILLET <christophe.jaillet@wanadoo.fr>:
> 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
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-07 20:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-07 15:22 [PATCH] ksmbd: Fix an error handling path in 'smb2_sess_setup()' Christophe JAILLET
2021-11-07 20:33 ` Namjae Jeon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).