virtio-net: unbreak any layout
commitfeb93f361739071778ca2d23df3876db399548f7
authorJason Wang <jasowang@redhat.com>
Fri, 17 Jul 2015 07:19:18 +0000 (17 15:19 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 20 Jul 2015 11:19:41 +0000 (20 14:19 +0300)
tree4e343f13bc3292507b1e08e6cc5f8c29def4f552
parentd345ed2da3279b015605823397235b8c5ca5251f
virtio-net: unbreak any layout

Commit 032a74a1c0fcdd5fd1c69e56126b4c857ee36611
("virtio-net: byteswap virtio-net header") breaks any layout by
requiring out_sg[0].iov_len >= n->guest_hdr_len. Fixing this by
copying header to temporary buffer if swap is needed, and then use
this buffer as part of out_sg.

Fixes 032a74a1c0fcdd5fd1c69e56126b4c857ee36611
("virtio-net: byteswap virtio-net header")
Cc: qemu-stable@nongnu.org
Cc: clg@fr.ibm.com
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
hw/net/virtio-net.c
include/hw/virtio/virtio-access.h