virtio-net: fix refill races during restore
Subsystems (4)
PATCH 1/1 virtio-net: fix refill races during restore
During restoring, try_fill_recv() was called with neither napi lock nor napi disabled. This can lead two try_fill_recv() was called in the same time. Fix this by refilling before trying to enable napi.
Fixes 0741bcb5584f9e2390ae6261573c4de8314999f2 (virtio: net: Add freeze, restore handlers to support S4).
--- drivers/net/virtio_net.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/virtio_net.c +6 -5
@@ -1797,16 +1797,17 @@ static int virtnet_restore(struct virtio_device *vdev)if (err)return err; -if (netif_running (vi->dev)) +if (netif_running (vi->dev)) { +for (i =0 ; i < vi->curr_queue_pairs; i++) +if (!try_fill_recv (&vi->rq[i],GFP_KERNEL )) +schedule_delayed_work (&vi->refill,0 ); +for (i =0 ; i < vi->max_queue_pairs; i++)virtnet_napi_enable (&vi->rq[i]); + }netif_device_attach (vi->dev); -for (i =0 ; i < vi->curr_queue_pairs; i++) -if (!try_fill_recv (&vi->rq[i],GFP_KERNEL )) -schedule_delayed_work (&vi->refill,0 ); -mutex_lock (&vi->config_lock); vi->config_enable = true;mutex_unlock (&vi->config_lock);
Signature · 1 line
1.8.3.2
David Miller
maintainerFrom: Jason Wang <[email protected]>
Date: Mon, 30 Dec 2013 11:34:40 +0800
Quoted 4 lines
During restoring,
try_fill_recv()was called with neither napi lock nor napi disabled. This can lead twotry_fill_recv()was called in the same time. Fix this by refilling before trying to enable napi.
Quoted 8 lines
Fixes
0741bcb5584f9e2390ae6261573c4de8314999f2(virtio: net: Add freeze, restore handlers to support S4).Cc Amit Shah <[email protected]>Cc Rusty Russell <[email protected]>Cc Michael S. Tsirkin <[email protected]>Cc Eric Dumazet <[email protected]>Signed-off-by Jason Wang <[email protected]>
Applied and queued up for -stable, thanks.