diff mbox series

cifs: Fix encryption/signing

Message ID 20180613165414.4967-1-paulo@paulo.ac
State New
Headers show
Series cifs: Fix encryption/signing | expand

Commit Message

Paulo Alcantara (SUSE) June 13, 2018, 4:54 p.m. UTC
Since the rfc1002 generation was moved down to __smb_send_rqst(),
the transform header is now in rqst->rq_iov[0].

Correctly assign the transform header pointer in crypt_message().

Signed-off-by: Paulo Alcantara <palcantara@suse.de>
---
 fs/cifs/smb2ops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Ronnie Sahlberg June 13, 2018, 8:55 p.m. UTC | #1
Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com>

Thanks !


----- Original Message -----
From: "Paulo Alcantara" <paulo@paulo.ac>
To: linux-cifs@vger.kernel.org
Cc: smfrench@gmail.com, "Paulo Alcantara" <paulo@paulo.ac>, "Paulo Alcantara" <palcantara@suse.de>
Sent: Thursday, 14 June, 2018 2:54:14 AM
Subject: [PATCH] cifs: Fix encryption/signing

Since the rfc1002 generation was moved down to __smb_send_rqst(),
the transform header is now in rqst->rq_iov[0].

Correctly assign the transform header pointer in crypt_message().

Signed-off-by: Paulo Alcantara <palcantara@suse.de>
---
 fs/cifs/smb2ops.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index d1648a9753d0..f5fe37d698bf 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2171,7 +2171,7 @@ static inline void smb2_sg_set_buf(struct scatterlist *sg, const void *buf,
 }
 
 /* Assumes:
- * rqst->rq_iov[0]  is tranform header
+ * rqst->rq_iov[0]  is transform header
  * rqst->rq_iov[1+] data to be encrypted/decrypted
  */
 static struct scatterlist *
@@ -2233,7 +2233,7 @@ static int
 crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc)
 {
 	struct smb2_transform_hdr *tr_hdr =
-			(struct smb2_transform_hdr *)rqst->rq_iov[1].iov_base;
+			(struct smb2_transform_hdr *)rqst->rq_iov[0].iov_base;
 	unsigned int assoc_data_len = sizeof(struct smb2_transform_hdr) - 20;
 	int rc = 0;
 	struct scatterlist *sg;
Aurélien Aptel June 14, 2018, 8:43 a.m. UTC | #2
Paulo Alcantara <paulo@paulo.ac> writes:
> Since the rfc1002 generation was moved down to __smb_send_rqst(),
> the transform header is now in rqst->rq_iov[0].
>
> Correctly assign the transform header pointer in crypt_message().

Good catch :)

Cheers,
diff mbox series

Patch

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index d1648a9753d0..f5fe37d698bf 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -2171,7 +2171,7 @@  static inline void smb2_sg_set_buf(struct scatterlist *sg, const void *buf,
 }
 
 /* Assumes:
- * rqst->rq_iov[0]  is tranform header
+ * rqst->rq_iov[0]  is transform header
  * rqst->rq_iov[1+] data to be encrypted/decrypted
  */
 static struct scatterlist *
@@ -2233,7 +2233,7 @@  static int
 crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc)
 {
 	struct smb2_transform_hdr *tr_hdr =
-			(struct smb2_transform_hdr *)rqst->rq_iov[1].iov_base;
+			(struct smb2_transform_hdr *)rqst->rq_iov[0].iov_base;
 	unsigned int assoc_data_len = sizeof(struct smb2_transform_hdr) - 20;
 	int rc = 0;
 	struct scatterlist *sg;