ipv6: fix rtnl locking in setsockopt for anycast and multicast
authorSabrina Dubroca <sd@queasysnail.net>
Tue, 2 Sep 2014 08:29:29 +0000 (10:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Oct 2014 10:05:28 +0000 (12:05 +0200)
commite06d2bcb5b9918e3674198c32fce1a4524d11d40
tree1f9091ed6542f7a1916ceefb227305066d3cf4d7
parentaf3e4e5dc0f46c876f99b0f8cc3987fac4741593
ipv6: fix rtnl locking in setsockopt for anycast and multicast

[ Upstream commit a9ed4a2986e13011fcf4ed2d1a1647c53112f55b ]

Calling setsockopt with IPV6_JOIN_ANYCAST or IPV6_LEAVE_ANYCAST
triggers the assertion in addrconf_join_solict()/addrconf_leave_solict()

ipv6_sock_ac_join(), ipv6_sock_ac_drop(), ipv6_sock_ac_close() need to
take RTNL before calling ipv6_dev_ac_inc/dec. Same thing with
ipv6_sock_mc_join(), ipv6_sock_mc_drop(), ipv6_sock_mc_close() before
calling ipv6_dev_mc_inc/dec.

This patch moves ASSERT_RTNL() up a level in the call stack.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Reported-by: Tommi Rantala <tt.rantala@gmail.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/addrconf.c
net/ipv6/anycast.c
net/ipv6/mcast.c