提交 7cc76f51 编写于 作者: J Jason Wang 提交者: 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: NJason Wang <jasowang@redhat.com>
Acked-by: NHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册