virtio-net: don't do header check for dodgy gso packets
authorJason Wang <jasowang@redhat.com>
Wed, 24 Dec 2014 03:03:52 +0000 (11:03 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Dec 2014 23:53:20 +0000 (18:53 -0500)
There's no need to do header check for virtio-net since:

- Host sets dodgy for all gso packets from guest and check the header.
- Host should be prepared for all kinds of evil packets from guest, since
  malicious guest can send any kinds of packet.

So this patch sets NETIF_F_GSO_ROBUST for virtio-net to skip the check.

Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/virtio_net.c

index 5ca97713bfb33b5d5a7770f3ae6a2000a19df423..11e2e8131359cf609e75d65c1fd2e51cb03c64af 100644 (file)
@@ -1759,6 +1759,8 @@ static int virtnet_probe(struct virtio_device *vdev)
                if (virtio_has_feature(vdev, VIRTIO_NET_F_HOST_ECN))
                        dev->hw_features |= NETIF_F_TSO_ECN;
 
+               dev->features |= NETIF_F_GSO_ROBUST;
+
                if (gso)
                        dev->features |= dev->hw_features & NETIF_F_ALL_TSO;
                /* (!csum && gso) case will be fixed by register_netdev() */