diff options
author | Yuya Kusakabe <yuya.kusakabe@gmail.com> | 2020-02-25 04:32:11 +0100 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-02-25 22:50:55 +0100 |
commit | f1d4884d6871ded0592604b0e72e4a7bd292eab9 (patch) | |
tree | 8dc007db074025902c81b2d0a43e5df0c9fd0fb1 /drivers/net/virtio_net.c | |
parent | selftests/bpf: Print backtrace on SIGSEGV in test_progs (diff) | |
download | linux-f1d4884d6871ded0592604b0e72e4a7bd292eab9.tar.xz linux-f1d4884d6871ded0592604b0e72e4a7bd292eab9.zip |
virtio_net: Keep vnet header zeroed if XDP is loaded for small buffer
We do not want to care about the vnet header in receive_small() if XDP
is loaded, since we can not know whether or not the packet is modified
by XDP.
Fixes: f6b10209b90d ("virtio-net: switch to use build_skb() for small buffer")
Signed-off-by: Yuya Kusakabe <yuya.kusakabe@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Jason Wang <jasowang@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Link: https://lore.kernel.org/bpf/20200225033212.437563-1-yuya.kusakabe@gmail.com
Diffstat (limited to 'drivers/net/virtio_net.c')
-rw-r--r-- | drivers/net/virtio_net.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 2fe7a3188282..f39d0218bdaa 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -735,10 +735,10 @@ static struct sk_buff *receive_small(struct net_device *dev, } skb_reserve(skb, headroom - delta); skb_put(skb, len); - if (!delta) { + if (!xdp_prog) { buf += header_offset; memcpy(skb_vnet_hdr(skb), buf, vi->hdr_len); - } /* keep zeroed vnet hdr since packet was changed by bpf */ + } /* keep zeroed vnet hdr since XDP is loaded */ err: return skb; |