diff options
author | Denis V. Lunev <den@openvz.org> | 2008-02-29 11:18:32 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-02-29 11:18:32 -0800 |
commit | edf0208702007ec1f6a36756fdd005f771a4cf17 (patch) | |
tree | f323141ddde44db532d984ea7bf769a05220aa0c /net/netlink | |
parent | 9dfbec1fb2bedff6b118504055cd9f0485edba45 (diff) | |
download | blackbird-op-linux-edf0208702007ec1f6a36756fdd005f771a4cf17.tar.gz blackbird-op-linux-edf0208702007ec1f6a36756fdd005f771a4cf17.zip |
[NET]: Make netlink_kernel_release publically available as sk_release_kernel.
This staff will be needed for non-netlink kernel sockets, which should
also not pin a namespace like tcp_socket and icmp_socket.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Daniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/af_netlink.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index e6b636d53633..524e826bb976 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1372,8 +1372,7 @@ netlink_kernel_create(struct net *net, int unit, unsigned int groups, goto out_sock_release_nosk; sk = sock->sk; - put_net(sk->sk_net); - sk->sk_net = net; + sk_change_net(sk, net); if (groups < 32) groups = 32; @@ -1421,20 +1420,7 @@ EXPORT_SYMBOL(netlink_kernel_create); void netlink_kernel_release(struct sock *sk) { - /* - * Last sock_put should drop referrence to sk->sk_net. It has already - * been dropped in netlink_kernel_create. Taking referrence to stopping - * namespace is not an option. - * Take referrence to a socket to remove it from netlink lookup table - * _alive_ and after that destroy it in the context of init_net. - */ - if (sk == NULL || sk->sk_socket == NULL) - return; - - sock_hold(sk); - sock_release(sk->sk_socket); - sk->sk_net = get_net(&init_net); - sock_put(sk); + sk_release_kernel(sk); } EXPORT_SYMBOL(netlink_kernel_release); |