Commit 713a98d9 authored by Jason Wang's avatar Jason Wang Committed by David S. Miller

virtio-net: serialize tx routine during reset

We don't hold any tx lock when trying to disable TX during reset, this
would lead a use after free since ndo_start_xmit() tries to access
the virtqueue which has already been freed. Fix this by using
netif_tx_disable() before freeing the vqs, this could make sure no tx
after vq freeing.
Reported-by: default avatarJean-Philippe Menil <jpmenil@gmail.com>
Tested-by: default avatarJean-Philippe Menil <jpmenil@gmail.com>
Fixes commit f600b690 ("virtio_net: Add XDP support")
Cc: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
Acked-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Acked-by: default avatarRobert McCabe <robert.mccabe@rockwellcollins.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e20bd60b
...@@ -1797,6 +1797,7 @@ static void virtnet_freeze_down(struct virtio_device *vdev) ...@@ -1797,6 +1797,7 @@ static void virtnet_freeze_down(struct virtio_device *vdev)
flush_work(&vi->config_work); flush_work(&vi->config_work);
netif_device_detach(vi->dev); netif_device_detach(vi->dev);
netif_tx_disable(vi->dev);
cancel_delayed_work_sync(&vi->refill); cancel_delayed_work_sync(&vi->refill);
if (netif_running(vi->dev)) { if (netif_running(vi->dev)) {
......
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