aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/icmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv6/icmp.c')
-rw-r--r--net/ipv6/icmp.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c
index 227ce3d2339d..195086114e63 100644
--- a/net/ipv6/icmp.c
+++ b/net/ipv6/icmp.c
@@ -64,6 +64,7 @@
64#include <net/addrconf.h> 64#include <net/addrconf.h>
65#include <net/icmp.h> 65#include <net/icmp.h>
66#include <net/xfrm.h> 66#include <net/xfrm.h>
67#include <net/inet_common.h>
67 68
68#include <asm/uaccess.h> 69#include <asm/uaccess.h>
69#include <asm/system.h> 70#include <asm/system.h>
@@ -808,9 +809,8 @@ static int __net_init icmpv6_sk_init(struct net *net)
808 return -ENOMEM; 809 return -ENOMEM;
809 810
810 for_each_possible_cpu(i) { 811 for_each_possible_cpu(i) {
811 struct socket *sock; 812 err = inet_ctl_sock_create(&sk, PF_INET6,
812 err = sock_create_kern(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6, 813 SOCK_RAW, IPPROTO_ICMPV6, net);
813 &sock);
814 if (err < 0) { 814 if (err < 0) {
815 printk(KERN_ERR 815 printk(KERN_ERR
816 "Failed to initialize the ICMP6 control socket " 816 "Failed to initialize the ICMP6 control socket "
@@ -819,10 +819,8 @@ static int __net_init icmpv6_sk_init(struct net *net)
819 goto fail; 819 goto fail;
820 } 820 }
821 821
822 net->ipv6.icmp_sk[i] = sk = sock->sk; 822 net->ipv6.icmp_sk[i] = sk;
823 sk_change_net(sk, net);
824 823
825 sk->sk_allocation = GFP_ATOMIC;
826 /* 824 /*
827 * Split off their lock-class, because sk->sk_dst_lock 825 * Split off their lock-class, because sk->sk_dst_lock
828 * gets used from softirqs, which is safe for 826 * gets used from softirqs, which is safe for
@@ -837,14 +835,12 @@ static int __net_init icmpv6_sk_init(struct net *net)
837 */ 835 */
838 sk->sk_sndbuf = 836 sk->sk_sndbuf =
839 (2 * ((64 * 1024) + sizeof(struct sk_buff))); 837 (2 * ((64 * 1024) + sizeof(struct sk_buff)));
840
841 sk->sk_prot->unhash(sk);
842 } 838 }
843 return 0; 839 return 0;
844 840
845 fail: 841 fail:
846 for (j = 0; j < i; j++) 842 for (j = 0; j < i; j++)
847 sk_release_kernel(net->ipv6.icmp_sk[j]); 843 inet_ctl_sock_destroy(net->ipv6.icmp_sk[j]);
848 kfree(net->ipv6.icmp_sk); 844 kfree(net->ipv6.icmp_sk);
849 return err; 845 return err;
850} 846}
@@ -854,7 +850,7 @@ static void __net_exit icmpv6_sk_exit(struct net *net)
854 int i; 850 int i;
855 851
856 for_each_possible_cpu(i) { 852 for_each_possible_cpu(i) {
857 sk_release_kernel(net->ipv6.icmp_sk[i]); 853 inet_ctl_sock_destroy(net->ipv6.icmp_sk[i]);
858 } 854 }
859 kfree(net->ipv6.icmp_sk); 855 kfree(net->ipv6.icmp_sk);
860} 856}