aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2015-03-18 14:50:43 -0300
committerDavid S. Miller <davem@davemloft.net>2015-03-18 22:05:09 -0400
commit54ff9ef36bdf84d469a098cbf8e2a103fbc77054 (patch)
tree74fb6219d97f44685a80b090888ffd5ea667e01e /drivers/net/vxlan.c
parentipv4,ipv6: grab rtnl before locking the socket (diff)
downloadlinux-dev-54ff9ef36bdf84d469a098cbf8e2a103fbc77054.tar.xz
linux-dev-54ff9ef36bdf84d469a098cbf8e2a103fbc77054.zip
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 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 25d92d4fc625..8b8ca7492d56 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1097,7 +1097,6 @@ EXPORT_SYMBOL_GPL(vxlan_sock_release);
/* Callback to update multicast group membership when first VNI on
* multicast asddress is brought up
- * Done as workqueue because ip_mc_join_group acquires RTNL.
*/
static void vxlan_igmp_join(struct work_struct *work)
{
@@ -1107,6 +1106,7 @@ static void vxlan_igmp_join(struct work_struct *work)
union vxlan_addr *ip = &vxlan->default_dst.remote_ip;
int ifindex = vxlan->default_dst.remote_ifindex;
+ rtnl_lock();
lock_sock(sk);
if (ip->sa.sa_family == AF_INET) {
struct ip_mreqn mreq = {
@@ -1122,6 +1122,7 @@ static void vxlan_igmp_join(struct work_struct *work)
#endif
}
release_sock(sk);
+ rtnl_unlock();
vxlan_sock_release(vs);
dev_put(vxlan->dev);
@@ -1136,6 +1137,7 @@ static void vxlan_igmp_leave(struct work_struct *work)
union vxlan_addr *ip = &vxlan->default_dst.remote_ip;
int ifindex = vxlan->default_dst.remote_ifindex;
+ rtnl_lock();
lock_sock(sk);
if (ip->sa.sa_family == AF_INET) {
struct ip_mreqn mreq = {
@@ -1152,6 +1154,7 @@ static void vxlan_igmp_leave(struct work_struct *work)
}
release_sock(sk);
+ rtnl_unlock();
vxlan_sock_release(vs);
dev_put(vxlan->dev);