macvtap: advance iov iterator when needed in macvtap_put_user()
authorJason Wang <jasowang@redhat.com>
Thu, 20 Nov 2014 08:31:05 +0000 (16:31 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Nov 2014 19:59:19 +0000 (14:59 -0500)
When mergeable buffer is used, vnet_hdr_sz is greater than sizeof struct
virtio_net_hdr. So we need advance the iov iterators in this case.

Fixes 6c36d2e26cda1ad3e2c4b90dd843825fc62fe5b4 ("macvtap: Use iovec iterators")
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/macvtap.c

index cea99d4a82630a958780d9dc5945552f0df27aa1..42a80d3de83911456d393580c658bd7a3c3cf80e 100644 (file)
@@ -797,6 +797,8 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
                if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=
                    sizeof(vnet_hdr))
                        return -EFAULT;
+
+               iov_iter_advance(iter, vnet_hdr_len - sizeof(vnet_hdr));
        }
        total = vnet_hdr_len;
        total += skb->len;