summaryrefslogtreecommitdiffstats
path: root/fs/cifs/sess.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilov@microsoft.com>2016-10-25 11:38:47 -0700
committerSteve French <smfrench@gmail.com>2017-02-01 16:46:34 -0600
commitda502f7df03d2d0b416775f92ae022f3f82bedd5 (patch)
tree1b6914dea96f1b0c0935dd9d82acd28b41b9ecc5 /fs/cifs/sess.c
parent31473fc4f9653b73750d3792ffce6a6e1bdf0da7 (diff)
downloadlinux-da502f7df03d2d0b416775f92ae022f3f82bedd5.tar.gz
linux-da502f7df03d2d0b416775f92ae022f3f82bedd5.tar.bz2
linux-da502f7df03d2d0b416775f92ae022f3f82bedd5.zip
CIFS: Make SendReceive2() takes resp iov
Now SendReceive2 frees the first iov and returns a response buffer in it that increases a code complexity. Simplify this by making a caller responsible for freeing request buffer itself and returning a response buffer in a separate iov. Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Diffstat (limited to 'fs/cifs/sess.c')
-rw-r--r--fs/cifs/sess.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 538d9b55699a..a1118e30e7c7 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -652,6 +652,7 @@ sess_sendreceive(struct sess_data *sess_data)
int rc;
struct smb_hdr *smb_buf = (struct smb_hdr *) sess_data->iov[0].iov_base;
__u16 count;
+ struct kvec rsp_iov = { NULL, 0 };
count = sess_data->iov[1].iov_len + sess_data->iov[2].iov_len;
smb_buf->smb_buf_length =
@@ -661,7 +662,9 @@ sess_sendreceive(struct sess_data *sess_data)
rc = SendReceive2(sess_data->xid, sess_data->ses,
sess_data->iov, 3 /* num_iovecs */,
&sess_data->buf0_type,
- CIFS_LOG_ERROR);
+ CIFS_LOG_ERROR, &rsp_iov);
+ cifs_small_buf_release(sess_data->iov[0].iov_base);
+ memcpy(&sess_data->iov[0], &rsp_iov, sizeof(struct kvec));
return rc;
}