[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1430988770-28907-7-git-send-email-ying.xue@windriver.com>
Date: Thu, 7 May 2015 16:52:45 +0800
From: Ying Xue <ying.xue@...driver.com>
To: <netdev@...r.kernel.org>
CC: <cwang@...pensource.com>, <herbert@...dor.apana.org.au>,
<xemul@...nvz.org>, <davem@...emloft.net>,
<eric.dumazet@...il.com>, <ebiederm@...ssion.com>,
<maxk@....qualcomm.com>, <stephen@...workplumber.org>,
<tgraf@...g.ch>, <nicolas.dichtel@...nd.com>,
<tom@...bertland.com>, <jchapman@...alix.com>,
<erik.hugne@...csson.com>, <jon.maloy@...csson.com>,
<horms@...ge.net.au>
Subject: [RFC PATCH net-next 06/11] ip6_udp_tunnel: avoid to switch namespace for tunnel socket
As there is no the race between put_net() and kernel socket creation,
it's unnecessary to switch namespace for a kernel tunnel socket from
init_net to its desirable one.
Signed-off-by: Ying Xue <ying.xue@...driver.com>
---
net/ipv6/ip6_udp_tunnel.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c
index bba8903..4da0bc5 100644
--- a/net/ipv6/ip6_udp_tunnel.c
+++ b/net/ipv6/ip6_udp_tunnel.c
@@ -19,11 +19,11 @@ int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
int err;
struct socket *sock = NULL;
- err = sock_create_kern(AF_INET6, SOCK_DGRAM, 0, &sock);
+ err = __sock_create(net, AF_INET6, SOCK_DGRAM, 0, &sock, 1);
if (err < 0)
goto error;
- sk_change_net(sock->sk, net);
+ put_net(sock_net(sock->sk));
udp6_addr.sin6_family = AF_INET6;
memcpy(&udp6_addr.sin6_addr, &cfg->local_ip6,
@@ -55,7 +55,8 @@ int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg,
error:
if (sock) {
kernel_sock_shutdown(sock, SHUT_RDWR);
- sk_release_kernel(sock->sk);
+ get_net(sock_net(sock->sk));
+ sock_release(sock);
}
*sockp = NULL;
return err;
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists