summaryrefslogtreecommitdiff
path: root/fs/cifs/cifsencrypt.c
diff options
context:
space:
mode:
authorAurelien Aptel <aaptel@suse.com>2018-06-04 22:29:34 +0200
committerSteve French <stfrench@microsoft.com>2018-06-04 19:17:59 -0500
commit57f933ce9fba4a1cecb6e34ffafe841d093493cb (patch)
tree49c78900055e02d765889b299bde161e5d71288b /fs/cifs/cifsencrypt.c
parent93e95fa57441b6976b39029bd658b6bbe7ccfe28 (diff)
CIFS: Fix signing for SMB2/3
It seems Ronnie's preamble removal broke signing. the signing functions are called when: A) we send a request (to sign it) B) when we recv a response (to check the signature). On code path A, the smb2 header is in iov[1] but on code path B, the smb2 header is in iov[0] (and there's only one vector). So we have different iov indexes for the smb2 header but the signing function always use index 1. Fix this by checking the nb of io vectors in the signing function as a hint. Signed-off-by: Aurelien Aptel <aaptel@suse.com> Reviewed-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/cifsencrypt.c')
-rw-r--r--fs/cifs/cifsencrypt.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index a6ef088e057b..d3e14d1fc0b5 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -37,6 +37,7 @@
#include <crypto/aead.h>
int __cifs_calc_signature(struct smb_rqst *rqst,
+ int start,
struct TCP_Server_Info *server, char *signature,
struct shash_desc *shash)
{
@@ -45,10 +46,7 @@ int __cifs_calc_signature(struct smb_rqst *rqst,
struct kvec *iov = rqst->rq_iov;
int n_vec = rqst->rq_nvec;
- if (n_vec < 2 || iov[0].iov_len != 4)
- return -EIO;
-
- for (i = 1; i < n_vec; i++) {
+ for (i = start; i < n_vec; i++) {
if (iov[i].iov_len == 0)
continue;
if (iov[i].iov_base == NULL) {
@@ -119,7 +117,7 @@ static int cifs_calc_signature(struct smb_rqst *rqst,
return rc;
}
- return __cifs_calc_signature(rqst, server, signature,
+ return __cifs_calc_signature(rqst, 1, server, signature,
&server->secmech.sdescmd5->shash);
}