linux-cifs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] ksmbd: use buf_data_size instead of recalculation in smb3_decrypt_req()
@ 2021-10-03  4:31 Namjae Jeon
  2021-10-03  4:31 ` [PATCH 2/3] ksmbd: fix version mismatch with out of tree Namjae Jeon
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Namjae Jeon @ 2021-10-03  4:31 UTC (permalink / raw)
  To: linux-cifs
  Cc: Namjae Jeon, Tom Talpey, Ronnie Sahlberg, Ralph Böhme,
	Steve French, Sergey Senozhatsky, Hyunchul Lee

Tom suggested to use buf_data_size that is already calculated, to verify
these offsets.

Cc: Tom Talpey <tom@talpey.com>
Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: Ralph Böhme <slow@samba.org>
Cc: Steve French <smfrench@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Hyunchul Lee <hyc.lee@gmail.com>
Suggested-by: Tom Talpey <tom@talpey.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
---
 fs/ksmbd/smb2pdu.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/ksmbd/smb2pdu.c b/fs/ksmbd/smb2pdu.c
index b06361313889..4d1be224dd8e 100644
--- a/fs/ksmbd/smb2pdu.c
+++ b/fs/ksmbd/smb2pdu.c
@@ -8457,15 +8457,13 @@ int smb3_decrypt_req(struct ksmbd_work *work)
 	struct smb2_transform_hdr *tr_hdr = (struct smb2_transform_hdr *)buf;
 	int rc = 0;
 
-	if (pdu_length + 4 <
-	    sizeof(struct smb2_transform_hdr) + sizeof(struct smb2_hdr)) {
+	if (buf_data_size < sizeof(struct smb2_hdr)) {
 		pr_err("Transform message is too small (%u)\n",
 		       pdu_length);
 		return -ECONNABORTED;
 	}
 
-	if (pdu_length + 4 <
-	    le32_to_cpu(tr_hdr->OriginalMessageSize) + sizeof(struct smb2_transform_hdr)) {
+	if (buf_data_size < le32_to_cpu(tr_hdr->OriginalMessageSize)) {
 		pr_err("Transform message is broken\n");
 		return -ECONNABORTED;
 	}
-- 
2.25.1


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

end of thread, other threads:[~2021-10-05 10:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03  4:31 [PATCH 1/3] ksmbd: use buf_data_size instead of recalculation in smb3_decrypt_req() Namjae Jeon
2021-10-03  4:31 ` [PATCH 2/3] ksmbd: fix version mismatch with out of tree Namjae Jeon
2021-10-03  4:31 ` [PATCH 3/3] ksmbd: fix oops from fuse driver Namjae Jeon
2021-10-05 10:13   ` Hyunchul Lee
2021-10-04  8:38 ` [PATCH 1/3] ksmbd: use buf_data_size instead of recalculation in smb3_decrypt_req() Hyunchul Lee
2021-10-04  8:58   ` Namjae Jeon
2021-10-04 11:14     ` Hyunchul Lee
2021-10-04 11:39       ` 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).