diff options
author | Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> | 2015-03-18 13:50:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-18 22:05:09 -0400 |
commit | 54ff9ef36bdf84d469a098cbf8e2a103fbc77054 (patch) | |
tree | 74fb6219d97f44685a80b090888ffd5ea667e01e /net/ipv6/mcast.c | |
parent | baf606d9c9b12517e47e0d1370e8aa9f7323f210 (diff) |
ipv4, ipv6: kill ip_mc_{join, leave}_group and ipv6_sock_mc_{join, drop}
in favor of their inner __ ones, which doesn't grab rtnl.
As these functions need to operate on a locked socket, we can't be
grabbing rtnl by then. It's too late and doing so causes reversed
locking.
So this patch:
- move rtnl handling to callers instead while already fixing some
reversed locking situations, like on vxlan and ipvs code.
- renames __ ones to not have the __ mark:
__ip_mc_{join,leave}_group -> ip_mc_{join,leave}_group
__ipv6_sock_mc_{join,drop} -> ipv6_sock_mc_{join,drop}
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/mcast.c')
-rw-r--r-- | net/ipv6/mcast.c | 30 |
1 files changed, 3 insertions, 27 deletions
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index 1dd1fedff9f4..cbb66fd3da6d 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -132,7 +132,7 @@ static int unsolicited_report_interval(struct inet6_dev *idev) | |||
132 | return iv > 0 ? iv : 1; | 132 | return iv > 0 ? iv : 1; |
133 | } | 133 | } |
134 | 134 | ||
135 | int __ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | 135 | int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) |
136 | { | 136 | { |
137 | struct net_device *dev = NULL; | 137 | struct net_device *dev = NULL; |
138 | struct ipv6_mc_socklist *mc_lst; | 138 | struct ipv6_mc_socklist *mc_lst; |
@@ -199,24 +199,12 @@ int __ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *add | |||
199 | 199 | ||
200 | return 0; | 200 | return 0; |
201 | } | 201 | } |
202 | EXPORT_SYMBOL(__ipv6_sock_mc_join); | ||
203 | |||
204 | int ipv6_sock_mc_join(struct sock *sk, int ifindex, const struct in6_addr *addr) | ||
205 | { | ||
206 | int ret; | ||
207 | |||
208 | rtnl_lock(); | ||
209 | ret = __ipv6_sock_mc_join(sk, ifindex, addr); | ||
210 | rtnl_unlock(); | ||
211 | |||
212 | return ret; | ||
213 | } | ||
214 | EXPORT_SYMBOL(ipv6_sock_mc_join); | 202 | EXPORT_SYMBOL(ipv6_sock_mc_join); |
215 | 203 | ||
216 | /* | 204 | /* |
217 | * socket leave on multicast group | 205 | * socket leave on multicast group |
218 | */ | 206 | */ |
219 | int __ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) | 207 | int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) |
220 | { | 208 | { |
221 | struct ipv6_pinfo *np = inet6_sk(sk); | 209 | struct ipv6_pinfo *np = inet6_sk(sk); |
222 | struct ipv6_mc_socklist *mc_lst; | 210 | struct ipv6_mc_socklist *mc_lst; |
@@ -255,18 +243,6 @@ int __ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *add | |||
255 | 243 | ||
256 | return -EADDRNOTAVAIL; | 244 | return -EADDRNOTAVAIL; |
257 | } | 245 | } |
258 | EXPORT_SYMBOL(__ipv6_sock_mc_drop); | ||
259 | |||
260 | int ipv6_sock_mc_drop(struct sock *sk, int ifindex, const struct in6_addr *addr) | ||
261 | { | ||
262 | int ret; | ||
263 | |||
264 | rtnl_lock(); | ||
265 | ret = __ipv6_sock_mc_drop(sk, ifindex, addr); | ||
266 | rtnl_unlock(); | ||
267 | |||
268 | return ret; | ||
269 | } | ||
270 | EXPORT_SYMBOL(ipv6_sock_mc_drop); | 246 | EXPORT_SYMBOL(ipv6_sock_mc_drop); |
271 | 247 | ||
272 | /* called with rcu_read_lock() */ | 248 | /* called with rcu_read_lock() */ |
@@ -460,7 +436,7 @@ done: | |||
460 | read_unlock_bh(&idev->lock); | 436 | read_unlock_bh(&idev->lock); |
461 | rcu_read_unlock(); | 437 | rcu_read_unlock(); |
462 | if (leavegroup) | 438 | if (leavegroup) |
463 | return ipv6_sock_mc_drop(sk, pgsr->gsr_interface, group); | 439 | err = ipv6_sock_mc_drop(sk, pgsr->gsr_interface, group); |
464 | return err; | 440 | return err; |
465 | } | 441 | } |
466 | 442 | ||