summaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp_tunnel.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-05-08 21:10:31 -0500
committerDavid S. Miller <davem@davemloft.net>2015-05-11 10:50:18 -0400
commit26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe (patch)
treee2161c09531299ce4bfbeb1506c420b9f8db7fc2 /net/ipv4/udp_tunnel.c
parent11aa9c28b4209242a9de0a661a7b3405adb568a0 (diff)
downloadlinux-26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe.tar.gz
linux-26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe.tar.xz
net: Modify sk_alloc to not reference count the netns of kernel sockets.
Now that sk_alloc knows when a kernel socket is being allocated modify it to not reference count the network namespace of kernel sockets. Keep track of if a socket needs reference counting by adding a flag to struct sock called sk_net_refcnt. Update all of the callers of sock_create_kern to stop using sk_change_net and sk_release_kernel as those hacks are no longer needed, to avoid reference counting a kernel socket. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/udp_tunnel.c')
-rw-r--r--net/ipv4/udp_tunnel.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/net/ipv4/udp_tunnel.c b/net/ipv4/udp_tunnel.c
index 4e2837476967..933ea903f7b8 100644
--- a/net/ipv4/udp_tunnel.c
+++ b/net/ipv4/udp_tunnel.c
@@ -15,12 +15,10 @@ int udp_sock_create4(struct net *net, struct udp_port_cfg *cfg,
struct socket *sock = NULL;
struct sockaddr_in udp_addr;
- err = sock_create_kern(&init_net, AF_INET, SOCK_DGRAM, 0, &sock);
+ err = sock_create_kern(net, AF_INET, SOCK_DGRAM, 0, &sock);
if (err < 0)
goto error;
- sk_change_net(sock->sk, net);
-
udp_addr.sin_family = AF_INET;
udp_addr.sin_addr = cfg->local_ip;
udp_addr.sin_port = cfg->local_udp_port;
@@ -47,7 +45,7 @@ int udp_sock_create4(struct net *net, struct udp_port_cfg *cfg,
error:
if (sock) {
kernel_sock_shutdown(sock, SHUT_RDWR);
- sk_release_kernel(sock->sk);
+ sock_release(sock);
}
*sockp = NULL;
return err;
@@ -101,7 +99,7 @@ void udp_tunnel_sock_release(struct socket *sock)
{
rcu_assign_sk_user_data(sock->sk, NULL);
kernel_sock_shutdown(sock, SHUT_RDWR);
- sk_release_kernel(sock->sk);
+ sock_release(sock);
}
EXPORT_SYMBOL_GPL(udp_tunnel_sock_release);