summaryrefslogtreecommitdiff
path: root/net/netfilter/ipvs/ip_vs_sync.c
diff options
context:
space:
mode:
authorJulian Anastasov <ja@ssi.bg>2015-07-26 14:57:34 +0300
committerSimon Horman <horms@verge.net.au>2015-08-21 09:09:09 -0700
commite0b26cc997d57305b4097711e12e13992580ae34 (patch)
tree7f6cfc4c19f8274c8cc9af7fea9379afdff706b5 /net/netfilter/ipvs/ip_vs_sync.c
parenteefa32d3f3c54bc7f9704968bc78adf0439c6c2a (diff)
ipvs: call rtnl_lock early
When the sync damon is started we need to hold rtnl lock while calling ip_mc_join_group. Currently, we have a wrong locking order because the correct one is rtnl_lock->__ip_vs_mutex. It is implied from the usage of __ip_vs_mutex in ip_vs_dst_event() which is called under rtnl lock during NETDEV_* notifications. Fix the problem by calling rtnl_lock early only for the start_sync_thread call. As a bonus this fixes the usage __dev_get_by_name which was not called under rtnl lock. This patch actually extends and depends on commit 54ff9ef36bdf ("ipv4, ipv6: kill ip_mc_{join, leave}_group and ipv6_sock_mc_{join, drop}"). Signed-off-by: Julian Anastasov <ja@ssi.bg> Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net/netfilter/ipvs/ip_vs_sync.c')
-rw-r--r--net/netfilter/ipvs/ip_vs_sync.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/net/netfilter/ipvs/ip_vs_sync.c b/net/netfilter/ipvs/ip_vs_sync.c
index d99ad93eb855..6bc6dca9bca8 100644
--- a/net/netfilter/ipvs/ip_vs_sync.c
+++ b/net/netfilter/ipvs/ip_vs_sync.c
@@ -1405,11 +1405,9 @@ join_mcast_group(struct sock *sk, struct in_addr *addr, char *ifname)
mreq.imr_ifindex = dev->ifindex;
- rtnl_lock();
lock_sock(sk);
ret = ip_mc_join_group(sk, &mreq);
release_sock(sk);
- rtnl_unlock();
return ret;
}