diff mbox

[utopic,1/1] Drivers: hv: util: make struct hv_do_fcopy match Hyper-V host messages

Message ID 1421080963-17627-2-git-send-email-apw@canonical.com
State New
Headers show

Commit Message

Andy Whitcroft Jan. 12, 2015, 4:42 p.m. UTC
From: Vitaly Kuznetsov <vkuznets@redhat.com>

An attempt to fix fcopy on i586 (bc5a5b0 Drivers: hv: util: Properly pack the data
for file copy functionality) led to a regression on x86_64 (and actually didn't fix
i586 breakage). Fcopy messages from Hyper-V host come in the following format:

struct do_fcopy_hdr   |   36 bytes
0000                  |    4 bytes
offset                |    8 bytes
size                  |    4 bytes
data                  | 6144 bytes

On x86_64 struct hv_do_fcopy matched this format without ' __attribute__((packed))'
and on i586 adding ' __attribute__((packed))' to it doesn't change anything. Keep
the structure packed and add padding to match re reality. Tested both i586 and x86_64
on Hyper-V Server 2012 R2.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 31d4ea1a093fcf668d5f95af44b8d41488bdb7ec)
BugLink: http://bugs.launchpad.net/bugs/1401903
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
 include/uapi/linux/hyperv.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Brad Figg Jan. 12, 2015, 5:24 p.m. UTC | #1
On Mon, Jan 12, 2015 at 04:42:43PM +0000, Andy Whitcroft wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
> 
> An attempt to fix fcopy on i586 (bc5a5b0 Drivers: hv: util: Properly pack the data
> for file copy functionality) led to a regression on x86_64 (and actually didn't fix
> i586 breakage). Fcopy messages from Hyper-V host come in the following format:
> 
> struct do_fcopy_hdr   |   36 bytes
> 0000                  |    4 bytes
> offset                |    8 bytes
> size                  |    4 bytes
> data                  | 6144 bytes
> 
> On x86_64 struct hv_do_fcopy matched this format without ' __attribute__((packed))'
> and on i586 adding ' __attribute__((packed))' to it doesn't change anything. Keep
> the structure packed and add padding to match re reality. Tested both i586 and x86_64
> on Hyper-V Server 2012 R2.
> 
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> (cherry picked from commit 31d4ea1a093fcf668d5f95af44b8d41488bdb7ec)
> BugLink: http://bugs.launchpad.net/bugs/1401903
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> ---
>  include/uapi/linux/hyperv.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
> index 0a8e6ba..bb1cb73 100644
> --- a/include/uapi/linux/hyperv.h
> +++ b/include/uapi/linux/hyperv.h
> @@ -134,6 +134,7 @@ struct hv_start_fcopy {
>  
>  struct hv_do_fcopy {
>  	struct hv_fcopy_hdr hdr;
> +	__u32   pad;
>  	__u64	offset;
>  	__u32	size;
>  	__u8	data[DATA_FRAGMENT];
> -- 
> 2.1.4
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team

Looks reasonable
diff mbox

Patch

diff --git a/include/uapi/linux/hyperv.h b/include/uapi/linux/hyperv.h
index 0a8e6ba..bb1cb73 100644
--- a/include/uapi/linux/hyperv.h
+++ b/include/uapi/linux/hyperv.h
@@ -134,6 +134,7 @@  struct hv_start_fcopy {
 
 struct hv_do_fcopy {
 	struct hv_fcopy_hdr hdr;
+	__u32   pad;
 	__u64	offset;
 	__u32	size;
 	__u8	data[DATA_FRAGMENT];