mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
hv_netvsc: disable NAPI before channel close
[ Commit8348e0460aupstream. ] This makes sure that no CPU is still process packets when the channel is closed. Fixes:76bb5db5c7("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f9aab25e33
commit
1f3ef8a7a3
@@ -567,6 +567,10 @@ void netvsc_device_remove(struct hv_device *device)
|
||||
|
||||
RCU_INIT_POINTER(net_device_ctx->nvdev, NULL);
|
||||
|
||||
/* And disassociate NAPI context from device */
|
||||
for (i = 0; i < net_device->num_chn; i++)
|
||||
netif_napi_del(&net_device->chan_table[i].napi);
|
||||
|
||||
/*
|
||||
* At this point, no one should be accessing net_device
|
||||
* except in here
|
||||
@@ -578,10 +582,6 @@ void netvsc_device_remove(struct hv_device *device)
|
||||
|
||||
netvsc_teardown_gpadl(device, net_device);
|
||||
|
||||
/* And dissassociate NAPI context from device */
|
||||
for (i = 0; i < net_device->num_chn; i++)
|
||||
netif_napi_del(&net_device->chan_table[i].napi);
|
||||
|
||||
/* Release all resources */
|
||||
free_netvsc_device_rcu(net_device);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user