summaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2018-08-01 09:26:11 +1000
committerSteve French <stfrench@microsoft.com>2018-08-07 14:21:18 -0500
commitb2c96de7fe3cd306df039c89727cb137b89d82ef (patch)
tree0c96ff5ea9879007c5a4ea9282939b4cf8eb9e25 /fs/cifs/transport.c
parent3de5e974ba65fd1629fb6ea0cb5222c78b1580ec (diff)
downloadlinux-b2c96de7fe3cd306df039c89727cb137b89d82ef.tar.bz2
cifs: update init_sg, crypt_message to take an array of rqst
These are used for SMB3 encryption and compounded requests. Update these functions and the other functions related to SMB3 encryption to take an array of requests. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 357d25351ffa..8039c93ba57a 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -374,27 +374,40 @@ smbd_done:
return rc;
}
+#define MAX_COMPOUND 2
+
static int
smb_send_rqst(struct TCP_Server_Info *server, struct smb_rqst *rqst, int flags)
{
- struct smb_rqst cur_rqst;
+ struct kvec iov;
+ struct smb2_transform_hdr tr_hdr;
+ struct smb_rqst cur_rqst[MAX_COMPOUND];
int rc;
if (!(flags & CIFS_TRANSFORM_REQ))
return __smb_send_rqst(server, 1, rqst);
- if (!server->ops->init_transform_rq ||
- !server->ops->free_transform_rq) {
- cifs_dbg(VFS, "Encryption requested but transform callbacks are missed\n");
+ memset(&cur_rqst[0], 0, sizeof(cur_rqst));
+ memset(&iov, 0, sizeof(iov));
+ memset(&tr_hdr, 0, sizeof(tr_hdr));
+
+ iov.iov_base = &tr_hdr;
+ iov.iov_len = sizeof(tr_hdr);
+ cur_rqst[0].rq_iov = &iov;
+ cur_rqst[0].rq_nvec = 1;
+
+ if (!server->ops->init_transform_rq) {
+ cifs_dbg(VFS, "Encryption requested but transform callback "
+ "is missing\n");
return -EIO;
}
- rc = server->ops->init_transform_rq(server, &cur_rqst, rqst);
+ rc = server->ops->init_transform_rq(server, 2, &cur_rqst[0], rqst);
if (rc)
return rc;
- rc = __smb_send_rqst(server, 1, &cur_rqst);
- server->ops->free_transform_rq(&cur_rqst);
+ rc = __smb_send_rqst(server, 2, &cur_rqst[0]);
+ smb3_free_compound_rqst(1, &cur_rqst[1]);
return rc;
}