Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751920AbdIVGm4 (ORCPT ); Fri, 22 Sep 2017 02:42:56 -0400 Received: from a2nlsmtp01-03.prod.iad2.secureserver.net ([198.71.225.37]:51296 "EHLO a2nlsmtp01-03.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751637AbdIVGmy (ORCPT ); Fri, 22 Sep 2017 02:42:54 -0400 x-originating-ip: 107.180.71.197 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com, marcelo.cerri@canonical.com, sthemmin@microsoft.com Cc: "K . Y . Srinivasan" , stable@vger.kernel.org Subject: [PATCH 2/2] Drivers: hv: fcopy: restore correct transfer length Date: Thu, 21 Sep 2017 23:41:48 -0700 Message-Id: <20170922064148.10517-2-kys@exchange.microsoft.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170922064148.10517-1-kys@exchange.microsoft.com> References: <20170922064029.10459-1-kys@exchange.microsoft.com> <20170922064148.10517-1-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfKaMFMYkRVPZyz4XOXHWz1xHaJOtvqeoGIu33YOdqMGr2SHA+16xQFMi+0/85cies705gwIvSi4Un3lJpVsLkIDhkq+RKdyw5W4eWAKJdEwLSrwyRrv1 wJZkpLZcZmI0MX7fdHWwL2n3Sx3MFny7Wlr5mQNIP7jTXZ7Lq5RBZYdmpfxtPxxXZcJeScLrtKHAzKR7ZRcpHC+N2erDifCWKBohUHKt0rwuhtHuE6dBL+Ng YoENB6VkhUNnqFKl9QyDrVdxHn0segipfNv74aMZojCeRQezH9ISAlDQxMrkwKZxiKSzJV32CHA4ROIT6S9VmJmZyA+CJ6mOG+cyicyXyX078t6ChtcKUgwd QxoUj9XAvMKXuiuHEwmWz5DaZrjs09+LDE3OyY34+G/Rs7TE7lt2zOE1TSmH2Hc4b1SY8NDESx9dksL3vq9FnpUUVrk8uJ5ArP641LZ0481tTe2ddbHfI74f Na6L6UPc0jWA3YdZIIifgF7IZE36QW+w4n3ugfj7I3mY4DL3rHcDD8dN5YC97Hfyv8pXLwlps2raVtzZGnsz77jgdKbYxiDbf0wELg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1828 Lines: 48 From: Olaf Hering Till recently the expected length of bytes read by the daemon did depend on the context. It was either hv_start_fcopy or hv_do_fcopy. The daemon had a buffer size of two pages, which was much larger than needed. Now the expected length of bytes read by the daemon changed slightly. For START_FILE_COPY it is still the size of hv_start_fcopy. But for WRITE_TO_FILE and the other operations it is as large as the buffer that arrived via vmbus. In case of WRITE_TO_FILE that is slightly larger than a struct hv_do_fcopy. Since the buffer in the daemon was still larger everything was fine. Currently, the daemon reads only what is actually needed. The new buffer layout is as large as a struct hv_do_fcopy, for the WRITE_TO_FILE operation. Since the kernel expects a slightly larger size, hvt_op_read will return -EINVAL because the daemon will read slightly less than expected. Address this by restoring the expected buffer size in case of WRITE_TO_FILE. Fixes: 'c7e490fc23eb ("Drivers: hv: fcopy: convert to hv_utils_transport")' Fixes: '3f2baa8a7d2e ("Tools: hv: update buffer handling in hv_fcopy_daemon")' Signed-off-by: Olaf Hering Signed-off-by: K. Y. Srinivasan Cc: stable@vger.kernel.org --- drivers/hv/hv_fcopy.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c index daa75bd41f86..2364281d8593 100644 --- a/drivers/hv/hv_fcopy.c +++ b/drivers/hv/hv_fcopy.c @@ -170,6 +170,10 @@ static void fcopy_send_data(struct work_struct *dummy) out_src = smsg_out; break; + case WRITE_TO_FILE: + out_src = fcopy_transaction.fcopy_msg; + out_len = sizeof(struct hv_do_fcopy); + break; default: out_src = fcopy_transaction.fcopy_msg; out_len = fcopy_transaction.recv_len; -- 2.14.1