Commit 9dfbec1f authored by Denis V. Lunev's avatar Denis V. Lunev Committed by David S. Miller
Browse files

[NETLINK]: No need for a separate __netlink_release call.



Merge it to netlink_kernel_release.
Signed-off-by: default avatarDenis V. Lunev <den@openvz.org>
Acked-by: default avatarDaniel Lezcano <dlezcano@fr.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 79c91159
...@@ -1344,22 +1344,6 @@ static void netlink_data_ready(struct sock *sk, int len) ...@@ -1344,22 +1344,6 @@ static void netlink_data_ready(struct sock *sk, int len)
* queueing. * queueing.
*/ */
static void __netlink_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.
*/
sock_hold(sk);
sock_release(sk->sk_socket);
sk->sk_net = get_net(&init_net);
sock_put(sk);
}
struct sock * struct sock *
netlink_kernel_create(struct net *net, int unit, unsigned int groups, netlink_kernel_create(struct net *net, int unit, unsigned int groups,
void (*input)(struct sk_buff *skb), void (*input)(struct sk_buff *skb),
...@@ -1424,7 +1408,7 @@ netlink_kernel_create(struct net *net, int unit, unsigned int groups, ...@@ -1424,7 +1408,7 @@ netlink_kernel_create(struct net *net, int unit, unsigned int groups,
out_sock_release: out_sock_release:
kfree(listeners); kfree(listeners);
__netlink_release(sk); netlink_kernel_release(sk);
return NULL; return NULL;
out_sock_release_nosk: out_sock_release_nosk:
...@@ -1437,10 +1421,20 @@ EXPORT_SYMBOL(netlink_kernel_create); ...@@ -1437,10 +1421,20 @@ EXPORT_SYMBOL(netlink_kernel_create);
void void
netlink_kernel_release(struct sock *sk) 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) if (sk == NULL || sk->sk_socket == NULL)
return; return;
__netlink_release(sk); sock_hold(sk);
sock_release(sk->sk_socket);
sk->sk_net = get_net(&init_net);
sock_put(sk);
} }
EXPORT_SYMBOL(netlink_kernel_release); EXPORT_SYMBOL(netlink_kernel_release);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment