[RH7] Revert "MS/NET/IPV6: remove duplicate neigh_ifdown"

Submitted by Vasily Averin on Dec. 23, 2020, 1:39 p.m.

Details

Message ID 727a52ca-3220-ae6d-6596-34a27b6fb20f@virtuozzo.com
State New
Series "Revert "MS/NET/IPV6: remove duplicate neigh_ifdown""
Headers show

Commit Message

Vasily Averin Dec. 23, 2020, 1:39 p.m.
This reverts commit 1727514587a11ec6c1a6704d86d9a0f3ec2d4bf1.
"MS/NET/IPV6: remove duplicate neigh_ifdown"

This patch should fix race described in PSBM-13449
"
addrconf_ifdown() calls neigh_ifdown(nd_tbl)
neigh_ifdown() locks nd_tbl->lock for writing and calls pneigh_ifdown()
Then we have the following call chain:
pneigh_ifdown->pndisc_destructor->ipv6_dev_mc_dec->__ipv6_dev_mc_dec
 ->igmp6_group_dropped->igmp6_leave_group->igmp6_send
   ->icmp6_dst_alloc->ndisc_get_neigh

ndisc_get_neigh() then calls __neigh_lookup_errno(nd_tbl) which calls neigh_lookup(nd_tbl)
neigh_lookup() locks nd_tbl->lock for reading yielding a deadlock."

Though it is not actual for vz7:
icmp6_dst_alloc() does not calls ndisc_get_neigh()

https://jira.sw.ru/browse/PSBM-124032
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 net/ipv6/addrconf.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index bc9babf..47789a2 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -3413,6 +3413,7 @@  static int addrconf_ifdown(struct net_device *dev, int how)
 	ASSERT_RTNL();
 
 	rt6_ifdown(net, dev);
+	neigh_ifdown(&nd_tbl, dev);
 
 	idev = __in6_dev_get(dev);
 	if (idev == NULL)