]> git.baikalelectronics.ru Git - kernel.git/commit
net: ipmr, ip6mr: fix vif/tunnel failure race condition
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Tue, 24 Nov 2015 16:09:30 +0000 (17:09 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Nov 2015 22:15:56 +0000 (17:15 -0500)
commit04b81d0c644da6182c7ada7dcee54dcd6d7e8da5
treec019c641c0c6130a769a596561529253e49bec13
parenta06a2090d7ecb96f30effef773056604cc4d9a6a
net: ipmr, ip6mr: fix vif/tunnel failure race condition

Since (at least) commit cf4d8b6374f1 ("[NET]: Do sysfs registration as
part of register_netdevice."), netdev_run_todo() deals only with
unregistration, so we don't need to do the rtnl_unlock/lock cycle to
finish registration when failing pimreg or dvmrp device creation. In
fact that opens a race condition where someone can delete the device
while rtnl is unlocked because it's fully registered. The problem gets
worse when netlink support is introduced as there are more points of entry
that can cause it and it also makes reusing that code correctly impossible.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Reviewed-by: Cong Wang <cwang@twopensource.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ipmr.c
net/ipv6/ip6mr.c