Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 89816
b: refs/heads/master
c: 9dfbec1
h: refs/heads/master
v: v3
  • Loading branch information
Denis V. Lunev authored and David S. Miller committed Feb 29, 2008
1 parent 5c1bc0c commit 3177324
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 79c911595390c8fdc8d8a487ac1951d854b1cd09
refs/heads/master: 9dfbec1fb2bedff6b118504055cd9f0485edba45
30 changes: 12 additions & 18 deletions trunk/net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1344,22 +1344,6 @@ static void netlink_data_ready(struct sock *sk, int len)
* 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 *
netlink_kernel_create(struct net *net, int unit, unsigned int groups,
void (*input)(struct sk_buff *skb),
Expand Down Expand Up @@ -1424,7 +1408,7 @@ netlink_kernel_create(struct net *net, int unit, unsigned int groups,

out_sock_release:
kfree(listeners);
__netlink_release(sk);
netlink_kernel_release(sk);
return NULL;

out_sock_release_nosk:
Expand All @@ -1437,10 +1421,20 @@ 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;

__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);

Expand Down

0 comments on commit 3177324

Please sign in to comment.