]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
virtio-net: forbid XDP when VIRTIO_NET_F_GUEST_UFO is support
authorJason Wang <jasowang@redhat.com>
Fri, 23 Dec 2016 14:37:30 +0000 (22:37 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 23 Dec 2016 18:48:55 +0000 (13:48 -0500)
When VIRTIO_NET_F_GUEST_UFO is negotiated, host could still send UFO
packet that exceeds a single page which could not be handled
correctly by XDP. So this patch forbids setting XDP when GUEST_UFO is
supported. While at it, forbid XDP for ECN (which comes only from GRO)
too to prevent user from misconfiguration.

Cc: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Acked-by: John Fastabend <john.r.fastabend@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c

index 77ae358ec6306c2b4b5abcece76d1fd14a178822..c1f66d8bfb7b9edb439eab4225bfb7fd43cc5376 100644 (file)
@@ -1684,7 +1684,9 @@ static int virtnet_xdp_set(struct net_device *dev, struct bpf_prog *prog)
        int i, err;
 
        if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO4) ||
-           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6)) {
+           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_TSO6) ||
+           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_ECN) ||
+           virtio_has_feature(vi->vdev, VIRTIO_NET_F_GUEST_UFO)) {
                netdev_warn(dev, "can't set XDP while host is implementing LRO, disable LRO first\n");
                return -EOPNOTSUPP;
        }