Skip to content

Commit

Permalink
virtio-net: serialize tx routine during reset
Browse files Browse the repository at this point in the history
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: Jean-Philippe Menil <[email protected]>
Tested-by: Jean-Philippe Menil <[email protected]>
Fixes commit f600b69 ("virtio_net: Add XDP support")
Cc: John Fastabend <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Acked-by: Robert McCabe <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
jasowang authored and davem330 committed Jun 29, 2017
1 parent e20bd60 commit 713a98d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/virtio_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,7 @@ static void virtnet_freeze_down(struct virtio_device *vdev)
flush_work(&vi->config_work);

netif_device_detach(vi->dev);
netif_tx_disable(vi->dev);
cancel_delayed_work_sync(&vi->refill);

if (netif_running(vi->dev)) {
Expand Down

0 comments on commit 713a98d

Please sign in to comment.