aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2018-03-20 18:03:02 -0400
committerDavid S. Miller <davem@davemloft.net>2018-03-22 12:45:09 -0400
commit8348e0460ab1473f06c8b824699dd2eed3c1979d (patch)
tree2c4f7d3d8dcabc3c8ef6c643ee71c46665c26f98 /drivers
parent68e2ffdeb5dbf54bc3a0684aa4e73c6db8675eed (diff)
hv_netvsc: disable NAPI before channel close
This makes sure that no CPU is still process packets when the channel is closed. Fixes: 76bb5db5c749 ("netvsc: fix use after free on module removal") Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/hyperv/netvsc.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c
index 0265d703eb03..e70a44273f55 100644
--- a/drivers/net/hyperv/netvsc.c
+++ b/drivers/net/hyperv/netvsc.c
@@ -568,6 +568,10 @@ void netvsc_device_remove(struct hv_device *device)
568 568
569 RCU_INIT_POINTER(net_device_ctx->nvdev, NULL); 569 RCU_INIT_POINTER(net_device_ctx->nvdev, NULL);
570 570
571 /* And disassociate NAPI context from device */
572 for (i = 0; i < net_device->num_chn; i++)
573 netif_napi_del(&net_device->chan_table[i].napi);
574
571 /* 575 /*
572 * At this point, no one should be accessing net_device 576 * At this point, no one should be accessing net_device
573 * except in here 577 * except in here
@@ -579,10 +583,6 @@ void netvsc_device_remove(struct hv_device *device)
579 583
580 netvsc_teardown_gpadl(device, net_device); 584 netvsc_teardown_gpadl(device, net_device);
581 585
582 /* And dissassociate NAPI context from device */
583 for (i = 0; i < net_device->num_chn; i++)
584 netif_napi_del(&net_device->chan_table[i].napi);
585
586 /* Release all resources */ 586 /* Release all resources */
587 free_netvsc_device_rcu(net_device); 587 free_netvsc_device_rcu(net_device);
588} 588}