]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.13.6/drivers-hv-fcopy-restore-correct-transfer-length.patch
fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 4.13.6 / drivers-hv-fcopy-restore-correct-transfer-length.patch
1 From 549e658a0919e355a2b2144dc380b3729bef7f3e Mon Sep 17 00:00:00 2001
2 From: Olaf Hering <olaf@aepfle.de>
3 Date: Thu, 21 Sep 2017 23:41:48 -0700
4 Subject: Drivers: hv: fcopy: restore correct transfer length
5
6 From: Olaf Hering <olaf@aepfle.de>
7
8 commit 549e658a0919e355a2b2144dc380b3729bef7f3e upstream.
9
10 Till recently the expected length of bytes read by the
11 daemon did depend on the context. It was either hv_start_fcopy or
12 hv_do_fcopy. The daemon had a buffer size of two pages, which was much
13 larger than needed.
14
15 Now the expected length of bytes read by the
16 daemon changed slightly. For START_FILE_COPY it is still the size of
17 hv_start_fcopy. But for WRITE_TO_FILE and the other operations it is as
18 large as the buffer that arrived via vmbus. In case of WRITE_TO_FILE
19 that is slightly larger than a struct hv_do_fcopy. Since the buffer in
20 the daemon was still larger everything was fine.
21
22 Currently, the daemon reads only what is actually needed.
23 The new buffer layout is as large as a struct hv_do_fcopy, for the
24 WRITE_TO_FILE operation. Since the kernel expects a slightly larger
25 size, hvt_op_read will return -EINVAL because the daemon will read
26 slightly less than expected. Address this by restoring the expected
27 buffer size in case of WRITE_TO_FILE.
28
29 Fixes: 'c7e490fc23eb ("Drivers: hv: fcopy: convert to hv_utils_transport")'
30 Fixes: '3f2baa8a7d2e ("Tools: hv: update buffer handling in hv_fcopy_daemon")'
31
32 Signed-off-by: Olaf Hering <olaf@aepfle.de>
33 Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
34 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36
37 ---
38 drivers/hv/hv_fcopy.c | 4 ++++
39 1 file changed, 4 insertions(+)
40
41 --- a/drivers/hv/hv_fcopy.c
42 +++ b/drivers/hv/hv_fcopy.c
43 @@ -170,6 +170,10 @@ static void fcopy_send_data(struct work_
44 out_src = smsg_out;
45 break;
46
47 + case WRITE_TO_FILE:
48 + out_src = fcopy_transaction.fcopy_msg;
49 + out_len = sizeof(struct hv_do_fcopy);
50 + break;
51 default:
52 out_src = fcopy_transaction.fcopy_msg;
53 out_len = fcopy_transaction.recv_len;