From 5c8cafd65e1448b1d55cad3fb1e42ad42607e5be Mon Sep 17 00:00:00 2001 From: "Denis V. Lunev" Date: Fri, 29 Feb 2008 11:19:22 -0800 Subject: [NETNS]: icmp(v6)_sk should not pin a namespace. So, change icmp(v6)_sk creation/disposal to the scheme used in the netlink for rtnl, i.e. create a socket in the context of the init_net and assign the namespace without getting a referrence later. Also use sk_release_kernel instead of sock_release to properly destroy such sockets. Signed-off-by: Denis V. Lunev Acked-by: Daniel Lezcano Signed-off-by: David S. Miller --- net/ipv4/icmp.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'net/ipv4/icmp.c') diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c index 7c62a0da5264..97d97ada4ce6 100644 --- a/net/ipv4/icmp.c +++ b/net/ipv4/icmp.c @@ -1146,14 +1146,8 @@ static void __exit icmp_exit(void) { int i; - for_each_possible_cpu(i) { - struct sock *sk; - - sk = __icmp_sk[i]; - if (sk == NULL) - continue; - sock_release(sk->sk_socket); - } + for_each_possible_cpu(i) + sk_release_kernel(__icmp_sk[i]); kfree(__icmp_sk); __icmp_sk = NULL; } @@ -1176,6 +1170,8 @@ int __init icmp_init(void) goto fail; __icmp_sk[i] = sk = sock->sk; + sk_change_net(sk, &init_net); + sk->sk_allocation = GFP_ATOMIC; /* Enough space for 2 64K ICMP packets, including -- cgit v1.2.3