Skip to contentSkip to conversation

ksmbd: Fix an error handling path in 'smb2_sess_setup()'

PATCH In review Namjae Jeon 2 participants 3 messages Nov 28, 2021 – Nov 29, 2021 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ksmbd: Fix an error handling path in 'smb2_sess_setup()'

From: Christophe JAILLET <[email protected]>

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")

---
v2:
- add missing Steve's signoff tag.

 fs/ksmbd/smb2pdu.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ksmbd/smb2pdu.c +4 -2
index 589694af4e95..9ae1d19ebc38 100644
@@ -1700,8 +1700,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) - 4) ||
-	    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);
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 9 lines · Namjae Jeon

From: Christophe JAILLET <[email protected]>

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.

Quoted 8 lines
Fixes 0d994cd482ee ("ksmbd: add buffer validation in session setup")

---
v2:
- add missing Steve's signoff tag.

What is the git id of this in Linus's tree?

And why no signed-off-by: from you? Please add that when doing backports and you have to change things.

thanks,

greg k-h

#2 lore raw

2021-11-29 21:12 GMT+09:00, Greg KH <[email protected]>:

Quoted 11 lines · Namjae Jeon
Quoted 10 lines

From: Christophe JAILLET <[email protected]>

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.

Quoted 8 lines
Quoted 8 lines
Fixes 0d994cd482ee ("ksmbd: add buffer validation in session setup")

---
v2:
- add missing Steve's signoff tag.

Hi Greg,

Quoted 2 lines

What is the git id of this in Linus's tree?

Sorry for that, My mistake, This patch in Linus's tree doesn't apply to linux-5.15.
I found out later that I hadn't copied while re-creating it.

Quoted 3 lines

And why no signed-off-by: from you? Please add that when doing backports and you have to change things.

Ah, I didn't know my signoff-by should add it. and I will do that next time :)

Thanks for your mail!

Quoted 5 lines

thanks,

greg k-h