• Stephen Hemminger's avatar
    hv_netvsc: fix deadlock on hotplug · 8195b139
    Stephen Hemminger authored
    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: 732e4985 ("netvsc: fix race on sub channel creation")
    Reported-by: default avatarDexuan Cui <decui@microsoft.com>
    Signed-off-by: default avatarStephen Hemminger <sthemmin@microsoft.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8195b139
netvsc.c 36.9 KB