aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/cifs/cifsencrypt.c11
-rw-r--r--fs/cifs/cifsproto.h2
-rw-r--r--fs/cifs/smb2transport.c11
-rw-r--r--fs/cifs/transport.c2
4 files changed, 25 insertions, 1 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index af520522ef20..652f5051be09 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -29,6 +29,7 @@
29#include "ntlmssp.h" 29#include "ntlmssp.h"
30#include <linux/ctype.h> 30#include <linux/ctype.h>
31#include <linux/random.h> 31#include <linux/random.h>
32#include <linux/highmem.h>
32 33
33/* 34/*
34 * Calculate and return the CIFS signature based on the mac key and SMB PDU. 35 * Calculate and return the CIFS signature based on the mac key and SMB PDU.
@@ -93,6 +94,16 @@ static int cifs_calc_signature(struct smb_rqst *rqst,
93 } 94 }
94 } 95 }
95 96
97 /* now hash over the rq_pages array */
98 for (i = 0; i < rqst->rq_npages; i++) {
99 struct kvec p_iov;
100
101 cifs_rqst_page_to_kvec(rqst, i, &p_iov);
102 crypto_shash_update(&server->secmech.sdescmd5->shash,
103 p_iov.iov_base, p_iov.iov_len);
104 kunmap(rqst->rq_pages[i]);
105 }
106
96 rc = crypto_shash_final(&server->secmech.sdescmd5->shash, signature); 107 rc = crypto_shash_final(&server->secmech.sdescmd5->shash, signature);
97 if (rc) 108 if (rc)
98 cERROR(1, "%s: Could not generate md5 hash", __func__); 109 cERROR(1, "%s: Could not generate md5 hash", __func__);
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 8e071a5a7da4..e97a1843ab98 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -36,6 +36,8 @@ extern struct smb_hdr *cifs_buf_get(void);
36extern void cifs_buf_release(void *); 36extern void cifs_buf_release(void *);
37extern struct smb_hdr *cifs_small_buf_get(void); 37extern struct smb_hdr *cifs_small_buf_get(void);
38extern void cifs_small_buf_release(void *); 38extern void cifs_small_buf_release(void *);
39extern void cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx,
40 struct kvec *iov);
39extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *, 41extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
40 unsigned int /* length */); 42 unsigned int /* length */);
41extern unsigned int _get_xid(void); 43extern unsigned int _get_xid(void);
diff --git a/fs/cifs/smb2transport.c b/fs/cifs/smb2transport.c
index 1850d9ec3c90..9ca4bcfb34c6 100644
--- a/fs/cifs/smb2transport.c
+++ b/fs/cifs/smb2transport.c
@@ -30,6 +30,7 @@
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <asm/processor.h> 31#include <asm/processor.h>
32#include <linux/mempool.h> 32#include <linux/mempool.h>
33#include <linux/highmem.h>
33#include "smb2pdu.h" 34#include "smb2pdu.h"
34#include "cifsglob.h" 35#include "cifsglob.h"
35#include "cifsproto.h" 36#include "cifsproto.h"
@@ -95,6 +96,16 @@ smb2_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
95 } 96 }
96 } 97 }
97 98
99 /* now hash over the rq_pages array */
100 for (i = 0; i < rqst->rq_npages; i++) {
101 struct kvec p_iov;
102
103 cifs_rqst_page_to_kvec(rqst, i, &p_iov);
104 crypto_shash_update(&server->secmech.sdeschmacsha256->shash,
105 p_iov.iov_base, p_iov.iov_len);
106 kunmap(rqst->rq_pages[i]);
107 }
108
98 rc = crypto_shash_final(&server->secmech.sdeschmacsha256->shash, 109 rc = crypto_shash_final(&server->secmech.sdeschmacsha256->shash,
99 sigptr); 110 sigptr);
100 if (rc) 111 if (rc)
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 381dbb778478..b6097344cd5b 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -251,7 +251,7 @@ smb_send_kvec(struct TCP_Server_Info *server, struct kvec *iov, size_t n_vec,
251 * The page will be kmapped and the address placed into iov_base. The length 251 * The page will be kmapped and the address placed into iov_base. The length
252 * will then be adjusted according to the ptailoff. 252 * will then be adjusted according to the ptailoff.
253 */ 253 */
254static void 254void
255cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx, 255cifs_rqst_page_to_kvec(struct smb_rqst *rqst, unsigned int idx,
256 struct kvec *iov) 256 struct kvec *iov)
257{ 257{