Commit 7cc76f51 authored by Jason Wang's avatar Jason Wang Committed by David S. Miller

macvtap: advance iov iterator when needed in macvtap_put_user()

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 6c36d2e2 ("macvtap: Use iovec iterators")
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 914efb02
...@@ -797,6 +797,8 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q, ...@@ -797,6 +797,8 @@ static ssize_t macvtap_put_user(struct macvtap_queue *q,
if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) != if (copy_to_iter(&vnet_hdr, sizeof(vnet_hdr), iter) !=
sizeof(vnet_hdr)) sizeof(vnet_hdr))
return -EFAULT; return -EFAULT;
iov_iter_advance(iter, vnet_hdr_len - sizeof(vnet_hdr));
} }
total = vnet_hdr_len; total = vnet_hdr_len;
total += skb->len; total += skb->len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment