diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-05-08 21:10:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-11 10:50:18 -0400 |
commit | 26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe (patch) | |
tree | e2161c09531299ce4bfbeb1506c420b9f8db7fc2 /net/ipv4/af_inet.c | |
parent | 11aa9c28b4209242a9de0a661a7b3405adb568a0 (diff) | |
download | op-kernel-dev-26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe.zip op-kernel-dev-26abe14379f8e2fa3fd1bcf97c9a7ad9364886fe.tar.gz |
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/af_inet.c')
-rw-r--r-- | net/ipv4/af_inet.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index e2dd9cb..235d36a 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c @@ -1430,7 +1430,7 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family, struct net *net) { struct socket *sock; - int rc = sock_create_kern(&init_net, family, type, protocol, &sock); + int rc = sock_create_kern(net, family, type, protocol, &sock); if (rc == 0) { *sk = sock->sk; @@ -1440,8 +1440,6 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family, * we do not wish this socket to see incoming packets. */ (*sk)->sk_prot->unhash(*sk); - - sk_change_net(*sk, net); } return rc; } |