diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-05-09 04:10:31 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-11 16:50:18 +0200 |
commit | 26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe (patch) | |
tree | e2161c09531299ce4bfbeb1506c420b9f8db7fc2 /net/ipv6/ip6_udp_tunnel.c | |
parent | net: Pass kern from net_proto_family.create to sk_alloc (diff) | |
download | linux-26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe.tar.xz linux-26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe.zip |
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/ipv6/ip6_udp_tunnel.c')
-rw-r--r-- | net/ipv6/ip6_udp_tunnel.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv6/ip6_udp_tunnel.c b/net/ipv6/ip6_udp_tunnel.c index 478576b61214..e1a1136bda7c 100644 --- a/net/ipv6/ip6_udp_tunnel.c +++ b/net/ipv6/ip6_udp_tunnel.c @@ -19,12 +19,10 @@ int udp_sock_create6(struct net *net, struct udp_port_cfg *cfg, int err; struct socket *sock = NULL; - err = sock_create_kern(&init_net, AF_INET6, SOCK_DGRAM, 0, &sock); + err = sock_create_kern(net, AF_INET6, SOCK_DGRAM, 0, &sock); if (err < 0) goto error; - sk_change_net(sock->sk, net); - udp6_addr.sin6_family = AF_INET6; memcpy(&udp6_addr.sin6_addr, &cfg->local_ip6, sizeof(udp6_addr.sin6_addr)); @@ -55,7 +53,7 @@ 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); + sock_release(sock); } *sockp = NULL; return err; |