diff options
author | stephen hemminger <stephen@networkplumber.org> | 2017-08-04 02:13:54 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-07 06:23:21 +0200 |
commit | 732e49850c5e15231e11a0a464748bcbade5e3c2 (patch) | |
tree | 5d000b7307ee1935be7492297897bf4bbb30c6ca /drivers/net/hyperv/netvsc.c | |
parent | bpf: fix byte order test in test_verifier (diff) | |
download | linux-732e49850c5e15231e11a0a464748bcbade5e3c2.tar.xz linux-732e49850c5e15231e11a0a464748bcbade5e3c2.zip |
netvsc: fix race on sub channel creation
The existing sub channel code did not wait for all the sub-channels
to completely initialize. This could lead to race causing crash
in napi_netif_del() from bad list. The existing code would send
an init message, then wait only for the initial response that
the init message was received. It thought it was waiting for
sub channels but really the init response did the wakeup.
The new code keeps track of the number of open channels and
waits until that many are open.
Other issues here were:
* host might return less sub-channels than was requested.
* the new init status is not valid until after init was completed.
Fixes: b3e6b82a0099 ("hv_netvsc: Wait for sub-channels to be processed during probe")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/hyperv/netvsc.c')
-rw-r--r-- | drivers/net/hyperv/netvsc.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 96f90c75d1b7..d18c3326a1f7 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -78,6 +78,7 @@ static struct netvsc_device *alloc_net_device(void) net_device->max_pkt = RNDIS_MAX_PKT_DEFAULT; net_device->pkt_align = RNDIS_PKT_ALIGN_DEFAULT; init_completion(&net_device->channel_init_wait); + init_waitqueue_head(&net_device->subchan_open); return net_device; } |