hv_netvsc: fix deadlock on hotplug
authorStephen Hemminger <stephen@networkplumber.org>
Wed, 6 Sep 2017 20:53:05 +0000 (13:53 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 11 Sep 2017 21:21:30 +0000 (14:21 -0700)
commit8195b1396ec86dddbba443c74b2188b423556c74
treea09b122fb16f158c00385cfc07bcea9e88722d59
parent4400081b631af69abc63cea3352680e3d85e0c39
hv_netvsc: fix deadlock on hotplug

When a virtual device is added dynamically (via host console), then
the vmbus sends an offer message for the primary channel. The processing
of this message for networking causes the network device to then
initialize the sub channels.

The problem is that setting up the sub channels needs to wait until
the subsequent subchannel offers have been processed. These offers
come in on the same ring buffer and work queue as where the primary
offer is being processed; leading to a deadlock.

This did not happen in older kernels, because the sub channel waiting
logic was broken (it wasn't really waiting).

The solution is to do the sub channel setup in its own work queue
context that is scheduled by the primary channel setup; and then
happens later.

Fixes: 732e49850c5e ("netvsc: fix race on sub channel creation")
Reported-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/hyperv/hyperv_net.h
drivers/net/hyperv/netvsc.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/hyperv/rndis_filter.c