From: Dexuan Cui <de...@microsoft.com>
Date: Thu, 30 Aug 2018 05:42:13 +0000

> 
> This patch fixes the race between netvsc_probe() and
> rndis_set_subchannel(), which can cause a deadlock.
> 
> These are the related 3 paths which show the deadlock:
 ...
> Before path #1 finishes, path #2 can start to run, because just before
> the "bus_probe_device(dev);" in device_add() in path #1, there is a line
> "object_uevent(&dev->kobj, KOBJ_ADD);", so systemd-udevd can
> immediately try to load hv_netvsc and hence path #2 can start to run.
> 
> Next, path #2 offloads the subchannal's initialization to a workqueue,
> i.e. path #3, so we can end up in a deadlock situation like this:
> 
> Path #2 gets the device lock, and is trying to get the rtnl lock;
> Path #3 gets the rtnl lock and is waiting for all the subchannel messages
> to be processed;
> Path #1 is trying to get the device lock, but since #2 is not releasing
> the device lock, path #1 has to sleep; since the VMBus messages are
> processed one by one, this means the sub-channel messages can't be
> procedded, so #3 has to sleep with the rtnl lock held, and finally #2
> has to sleep... Now all the 3 paths are sleeping and we hit the deadlock.
> 
> With the patch, we can make sure #2 gets both the device lock and the
> rtnl lock together, gets its job done, and releases the locks, so #1
> and #3 will not be blocked for ever.
> 
> Fixes: 8195b1396ec8 ("hv_netvsc: fix deadlock on hotplug")
> Signed-off-by: Dexuan Cui <de...@microsoft.com>

Applied and queued up for -stable.
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to