netvsc: fix deadlock betwen link status and removal
authorstephen hemminger <stephen@networkplumber.org>
Thu, 24 Aug 2017 23:49:16 +0000 (16:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Sep 2017 06:19:54 +0000 (08:19 +0200)
commitde2ecec26dba848c729e51faaf2b4daf35096330
tree290b3cecb971b0900817fb661af12b261bf52ecb
parent64dfc67548da52fe7891decf725342a8e87e32d8
netvsc: fix deadlock betwen link status and removal

[ Upstream commit 9b4e946ce14e20d7addbfb7d9139e604f9fda107 ]

There is a deadlock possible when canceling the link status
delayed work queue. The removal process is run with RTNL held,
and the link status callback is acquring RTNL.

Resolve the issue by using trylock and rescheduling.
If cancel is in process, that block it from happening.

Fixes: 122a5f6410f4 ("staging: hv: use delayed_work for netvsc_send_garp()")
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>
drivers/net/hyperv/netvsc_drv.c