diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-05-08 22:09:13 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-05-11 10:50:17 -0400 |
commit | 11aa9c28b4209242a9de0a661a7b3405adb568a0 (patch) | |
tree | d0dda021d89c17c54d54d227269f937d2d73b542 | |
parent | eeb1bd5c40edb0e2fd925c8535e2fdebdbc5cef2 (diff) |
net: Pass kern from net_proto_family.create to sk_alloc
In preparation for changing how struct net is refcounted
on kernel sockets pass the knowledge that we are creating
a kernel socket from sock_create_kern through to sk_alloc.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
59 files changed, 109 insertions, 108 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index f22cc56fd1b3..5ad0d5354535 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c | |||
@@ -244,7 +244,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock) | |||
244 | if (!type) | 244 | if (!type) |
245 | goto unlock; | 245 | goto unlock; |
246 | 246 | ||
247 | sk2 = sk_alloc(sock_net(sk), PF_ALG, GFP_KERNEL, &alg_proto); | 247 | sk2 = sk_alloc(sock_net(sk), PF_ALG, GFP_KERNEL, &alg_proto, 0); |
248 | err = -ENOMEM; | 248 | err = -ENOMEM; |
249 | if (!sk2) | 249 | if (!sk2) |
250 | goto unlock; | 250 | goto unlock; |
@@ -324,7 +324,7 @@ static int alg_create(struct net *net, struct socket *sock, int protocol, | |||
324 | return -EPROTONOSUPPORT; | 324 | return -EPROTONOSUPPORT; |
325 | 325 | ||
326 | err = -ENOMEM; | 326 | err = -ENOMEM; |
327 | sk = sk_alloc(net, PF_ALG, GFP_KERNEL, &alg_proto); | 327 | sk = sk_alloc(net, PF_ALG, GFP_KERNEL, &alg_proto, kern); |
328 | if (!sk) | 328 | if (!sk) |
329 | goto out; | 329 | goto out; |
330 | 330 | ||
diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c index 8dc7290089bb..0d29b5a6356d 100644 --- a/drivers/isdn/mISDN/socket.c +++ b/drivers/isdn/mISDN/socket.c | |||
@@ -601,14 +601,14 @@ static const struct proto_ops data_sock_ops = { | |||
601 | }; | 601 | }; |
602 | 602 | ||
603 | static int | 603 | static int |
604 | data_sock_create(struct net *net, struct socket *sock, int protocol) | 604 | data_sock_create(struct net *net, struct socket *sock, int protocol, int kern) |
605 | { | 605 | { |
606 | struct sock *sk; | 606 | struct sock *sk; |
607 | 607 | ||
608 | if (sock->type != SOCK_DGRAM) | 608 | if (sock->type != SOCK_DGRAM) |
609 | return -ESOCKTNOSUPPORT; | 609 | return -ESOCKTNOSUPPORT; |
610 | 610 | ||
611 | sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto); | 611 | sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern); |
612 | if (!sk) | 612 | if (!sk) |
613 | return -ENOMEM; | 613 | return -ENOMEM; |
614 | 614 | ||
@@ -756,14 +756,14 @@ static const struct proto_ops base_sock_ops = { | |||
756 | 756 | ||
757 | 757 | ||
758 | static int | 758 | static int |
759 | base_sock_create(struct net *net, struct socket *sock, int protocol) | 759 | base_sock_create(struct net *net, struct socket *sock, int protocol, int kern) |
760 | { | 760 | { |
761 | struct sock *sk; | 761 | struct sock *sk; |
762 | 762 | ||
763 | if (sock->type != SOCK_RAW) | 763 | if (sock->type != SOCK_RAW) |
764 | return -ESOCKTNOSUPPORT; | 764 | return -ESOCKTNOSUPPORT; |
765 | 765 | ||
766 | sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto); | 766 | sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern); |
767 | if (!sk) | 767 | if (!sk) |
768 | return -ENOMEM; | 768 | return -ENOMEM; |
769 | 769 | ||
@@ -785,7 +785,7 @@ mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern) | |||
785 | 785 | ||
786 | switch (proto) { | 786 | switch (proto) { |
787 | case ISDN_P_BASE: | 787 | case ISDN_P_BASE: |
788 | err = base_sock_create(net, sock, proto); | 788 | err = base_sock_create(net, sock, proto, kern); |
789 | break; | 789 | break; |
790 | case ISDN_P_TE_S0: | 790 | case ISDN_P_TE_S0: |
791 | case ISDN_P_NT_S0: | 791 | case ISDN_P_NT_S0: |
@@ -799,7 +799,7 @@ mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern) | |||
799 | case ISDN_P_B_L2DTMF: | 799 | case ISDN_P_B_L2DTMF: |
800 | case ISDN_P_B_L2DSP: | 800 | case ISDN_P_B_L2DSP: |
801 | case ISDN_P_B_L2DSPHDLC: | 801 | case ISDN_P_B_L2DSPHDLC: |
802 | err = data_sock_create(net, sock, proto); | 802 | err = data_sock_create(net, sock, proto, kern); |
803 | break; | 803 | break; |
804 | default: | 804 | default: |
805 | return err; | 805 | return err; |
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c index 8c350c5d54ad..0398631a3c24 100644 --- a/drivers/net/macvtap.c +++ b/drivers/net/macvtap.c | |||
@@ -476,7 +476,7 @@ static int macvtap_open(struct inode *inode, struct file *file) | |||
476 | 476 | ||
477 | err = -ENOMEM; | 477 | err = -ENOMEM; |
478 | q = (struct macvtap_queue *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, | 478 | q = (struct macvtap_queue *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, |
479 | &macvtap_proto); | 479 | &macvtap_proto, 0); |
480 | if (!q) | 480 | if (!q) |
481 | goto out; | 481 | goto out; |
482 | 482 | ||
diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index aa1dd926623a..f86c5ab334aa 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c | |||
@@ -546,11 +546,11 @@ static struct proto pppoe_sk_proto __read_mostly = { | |||
546 | * Initialize a new struct sock. | 546 | * Initialize a new struct sock. |
547 | * | 547 | * |
548 | **********************************************************************/ | 548 | **********************************************************************/ |
549 | static int pppoe_create(struct net *net, struct socket *sock) | 549 | static int pppoe_create(struct net *net, struct socket *sock, int kern) |
550 | { | 550 | { |
551 | struct sock *sk; | 551 | struct sock *sk; |
552 | 552 | ||
553 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto); | 553 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto, kern); |
554 | if (!sk) | 554 | if (!sk) |
555 | return -ENOMEM; | 555 | return -ENOMEM; |
556 | 556 | ||
diff --git a/drivers/net/ppp/pppox.c b/drivers/net/ppp/pppox.c index 2940e9fe351b..0e1b30622477 100644 --- a/drivers/net/ppp/pppox.c +++ b/drivers/net/ppp/pppox.c | |||
@@ -118,7 +118,7 @@ static int pppox_create(struct net *net, struct socket *sock, int protocol, | |||
118 | !try_module_get(pppox_protos[protocol]->owner)) | 118 | !try_module_get(pppox_protos[protocol]->owner)) |
119 | goto out; | 119 | goto out; |
120 | 120 | ||
121 | rc = pppox_protos[protocol]->create(net, sock); | 121 | rc = pppox_protos[protocol]->create(net, sock, kern); |
122 | 122 | ||
123 | module_put(pppox_protos[protocol]->owner); | 123 | module_put(pppox_protos[protocol]->owner); |
124 | out: | 124 | out: |
diff --git a/drivers/net/ppp/pptp.c b/drivers/net/ppp/pptp.c index e3bfbd4d0136..14839bc0aaf5 100644 --- a/drivers/net/ppp/pptp.c +++ b/drivers/net/ppp/pptp.c | |||
@@ -561,14 +561,14 @@ static void pptp_sock_destruct(struct sock *sk) | |||
561 | skb_queue_purge(&sk->sk_receive_queue); | 561 | skb_queue_purge(&sk->sk_receive_queue); |
562 | } | 562 | } |
563 | 563 | ||
564 | static int pptp_create(struct net *net, struct socket *sock) | 564 | static int pptp_create(struct net *net, struct socket *sock, int kern) |
565 | { | 565 | { |
566 | int error = -ENOMEM; | 566 | int error = -ENOMEM; |
567 | struct sock *sk; | 567 | struct sock *sk; |
568 | struct pppox_sock *po; | 568 | struct pppox_sock *po; |
569 | struct pptp_opt *opt; | 569 | struct pptp_opt *opt; |
570 | 570 | ||
571 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pptp_sk_proto); | 571 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pptp_sk_proto, kern); |
572 | if (!sk) | 572 | if (!sk) |
573 | goto out; | 573 | goto out; |
574 | 574 | ||
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 3262f3e2b8b2..1a1c4f7b3ec5 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -2148,7 +2148,7 @@ static int tun_chr_open(struct inode *inode, struct file * file) | |||
2148 | DBG1(KERN_INFO, "tunX: tun_chr_open\n"); | 2148 | DBG1(KERN_INFO, "tunX: tun_chr_open\n"); |
2149 | 2149 | ||
2150 | tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, | 2150 | tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL, |
2151 | &tun_proto); | 2151 | &tun_proto, 0); |
2152 | if (!tfile) | 2152 | if (!tfile) |
2153 | return -ENOMEM; | 2153 | return -ENOMEM; |
2154 | RCU_INIT_POINTER(tfile->tun, NULL); | 2154 | RCU_INIT_POINTER(tfile->tun, NULL); |
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index 66a7d7600f43..b49cf923becc 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h | |||
@@ -74,7 +74,7 @@ static inline struct sock *sk_pppox(struct pppox_sock *po) | |||
74 | struct module; | 74 | struct module; |
75 | 75 | ||
76 | struct pppox_proto { | 76 | struct pppox_proto { |
77 | int (*create)(struct net *net, struct socket *sock); | 77 | int (*create)(struct net *net, struct socket *sock, int kern); |
78 | int (*ioctl)(struct socket *sock, unsigned int cmd, | 78 | int (*ioctl)(struct socket *sock, unsigned int cmd, |
79 | unsigned long arg); | 79 | unsigned long arg); |
80 | struct module *owner; | 80 | struct module *owner; |
diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index 172632dd9930..db639a4c5ab8 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h | |||
@@ -74,7 +74,7 @@ void vsock_pending_work(struct work_struct *work); | |||
74 | struct sock *__vsock_create(struct net *net, | 74 | struct sock *__vsock_create(struct net *net, |
75 | struct socket *sock, | 75 | struct socket *sock, |
76 | struct sock *parent, | 76 | struct sock *parent, |
77 | gfp_t priority, unsigned short type); | 77 | gfp_t priority, unsigned short type, int kern); |
78 | 78 | ||
79 | /**** TRANSPORT ****/ | 79 | /**** TRANSPORT ****/ |
80 | 80 | ||
diff --git a/include/net/llc_conn.h b/include/net/llc_conn.h index 0134681acc4c..fe994d2e5286 100644 --- a/include/net/llc_conn.h +++ b/include/net/llc_conn.h | |||
@@ -96,7 +96,7 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb) | |||
96 | } | 96 | } |
97 | 97 | ||
98 | struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, | 98 | struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, |
99 | struct proto *prot); | 99 | struct proto *prot, int kern); |
100 | void llc_sk_free(struct sock *sk); | 100 | void llc_sk_free(struct sock *sk); |
101 | 101 | ||
102 | void llc_sk_reset(struct sock *sk); | 102 | void llc_sk_reset(struct sock *sk); |
diff --git a/include/net/sock.h b/include/net/sock.h index 3a4898ec8c67..d8dcf91732b0 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -1514,7 +1514,7 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow) | |||
1514 | 1514 | ||
1515 | 1515 | ||
1516 | struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | 1516 | struct sock *sk_alloc(struct net *net, int family, gfp_t priority, |
1517 | struct proto *prot); | 1517 | struct proto *prot, int kern); |
1518 | void sk_free(struct sock *sk); | 1518 | void sk_free(struct sock *sk); |
1519 | void sk_release_kernel(struct sock *sk); | 1519 | void sk_release_kernel(struct sock *sk); |
1520 | struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority); | 1520 | struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority); |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 3b7ad43c7dad..d5871ac493eb 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -1030,7 +1030,7 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol, | |||
1030 | if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) | 1030 | if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) |
1031 | goto out; | 1031 | goto out; |
1032 | rc = -ENOMEM; | 1032 | rc = -ENOMEM; |
1033 | sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto); | 1033 | sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, kern); |
1034 | if (!sk) | 1034 | if (!sk) |
1035 | goto out; | 1035 | goto out; |
1036 | rc = 0; | 1036 | rc = 0; |
diff --git a/net/atm/common.c b/net/atm/common.c index ed0466637e13..49a872db7e42 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -141,7 +141,7 @@ static struct proto vcc_proto = { | |||
141 | .release_cb = vcc_release_cb, | 141 | .release_cb = vcc_release_cb, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | int vcc_create(struct net *net, struct socket *sock, int protocol, int family) | 144 | int vcc_create(struct net *net, struct socket *sock, int protocol, int family, int kern) |
145 | { | 145 | { |
146 | struct sock *sk; | 146 | struct sock *sk; |
147 | struct atm_vcc *vcc; | 147 | struct atm_vcc *vcc; |
@@ -149,7 +149,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family) | |||
149 | sock->sk = NULL; | 149 | sock->sk = NULL; |
150 | if (sock->type == SOCK_STREAM) | 150 | if (sock->type == SOCK_STREAM) |
151 | return -EINVAL; | 151 | return -EINVAL; |
152 | sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto); | 152 | sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto, kern); |
153 | if (!sk) | 153 | if (!sk) |
154 | return -ENOMEM; | 154 | return -ENOMEM; |
155 | sock_init_data(sock, sk); | 155 | sock_init_data(sock, sk); |
diff --git a/net/atm/common.h b/net/atm/common.h index 4d6f5b2068ac..959436b87182 100644 --- a/net/atm/common.h +++ b/net/atm/common.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #include <linux/poll.h> /* for poll_table */ | 10 | #include <linux/poll.h> /* for poll_table */ |
11 | 11 | ||
12 | 12 | ||
13 | int vcc_create(struct net *net, struct socket *sock, int protocol, int family); | 13 | int vcc_create(struct net *net, struct socket *sock, int protocol, int family, int kern); |
14 | int vcc_release(struct socket *sock); | 14 | int vcc_release(struct socket *sock); |
15 | int vcc_connect(struct socket *sock, int itf, short vpi, int vci); | 15 | int vcc_connect(struct socket *sock, int itf, short vpi, int vci); |
16 | int vcc_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, | 16 | int vcc_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, |
diff --git a/net/atm/pvc.c b/net/atm/pvc.c index ae0324021407..040207ec399f 100644 --- a/net/atm/pvc.c +++ b/net/atm/pvc.c | |||
@@ -136,7 +136,7 @@ static int pvc_create(struct net *net, struct socket *sock, int protocol, | |||
136 | return -EAFNOSUPPORT; | 136 | return -EAFNOSUPPORT; |
137 | 137 | ||
138 | sock->ops = &pvc_proto_ops; | 138 | sock->ops = &pvc_proto_ops; |
139 | return vcc_create(net, sock, protocol, PF_ATMPVC); | 139 | return vcc_create(net, sock, protocol, PF_ATMPVC, kern); |
140 | } | 140 | } |
141 | 141 | ||
142 | static const struct net_proto_family pvc_family_ops = { | 142 | static const struct net_proto_family pvc_family_ops = { |
diff --git a/net/atm/svc.c b/net/atm/svc.c index 1ba23f5018e7..3fa0a9ee98d1 100644 --- a/net/atm/svc.c +++ b/net/atm/svc.c | |||
@@ -660,7 +660,7 @@ static int svc_create(struct net *net, struct socket *sock, int protocol, | |||
660 | return -EAFNOSUPPORT; | 660 | return -EAFNOSUPPORT; |
661 | 661 | ||
662 | sock->ops = &svc_proto_ops; | 662 | sock->ops = &svc_proto_ops; |
663 | error = vcc_create(net, sock, protocol, AF_ATMSVC); | 663 | error = vcc_create(net, sock, protocol, AF_ATMSVC, kern); |
664 | if (error) | 664 | if (error) |
665 | return error; | 665 | return error; |
666 | ATM_SD(sock)->local.sas_family = AF_ATMSVC; | 666 | ATM_SD(sock)->local.sas_family = AF_ATMSVC; |
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 330c1f4a5a0b..4273533d22b1 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c | |||
@@ -855,7 +855,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol, | |||
855 | return -ESOCKTNOSUPPORT; | 855 | return -ESOCKTNOSUPPORT; |
856 | } | 856 | } |
857 | 857 | ||
858 | sk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto); | 858 | sk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto, kern); |
859 | if (sk == NULL) | 859 | if (sk == NULL) |
860 | return -ENOMEM; | 860 | return -ENOMEM; |
861 | 861 | ||
@@ -881,7 +881,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev) | |||
881 | struct sock *sk; | 881 | struct sock *sk; |
882 | ax25_cb *ax25, *oax25; | 882 | ax25_cb *ax25, *oax25; |
883 | 883 | ||
884 | sk = sk_alloc(sock_net(osk), PF_AX25, GFP_ATOMIC, osk->sk_prot); | 884 | sk = sk_alloc(sock_net(osk), PF_AX25, GFP_ATOMIC, osk->sk_prot, 0); |
885 | if (sk == NULL) | 885 | if (sk == NULL) |
886 | return NULL; | 886 | return NULL; |
887 | 887 | ||
diff --git a/net/bluetooth/bnep/sock.c b/net/bluetooth/bnep/sock.c index bde2bdd9e929..b5116fa9835e 100644 --- a/net/bluetooth/bnep/sock.c +++ b/net/bluetooth/bnep/sock.c | |||
@@ -202,7 +202,7 @@ static int bnep_sock_create(struct net *net, struct socket *sock, int protocol, | |||
202 | if (sock->type != SOCK_RAW) | 202 | if (sock->type != SOCK_RAW) |
203 | return -ESOCKTNOSUPPORT; | 203 | return -ESOCKTNOSUPPORT; |
204 | 204 | ||
205 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto); | 205 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, kern); |
206 | if (!sk) | 206 | if (!sk) |
207 | return -ENOMEM; | 207 | return -ENOMEM; |
208 | 208 | ||
diff --git a/net/bluetooth/cmtp/sock.c b/net/bluetooth/cmtp/sock.c index d82787d417bd..ce86a7bae844 100644 --- a/net/bluetooth/cmtp/sock.c +++ b/net/bluetooth/cmtp/sock.c | |||
@@ -205,7 +205,7 @@ static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol, | |||
205 | if (sock->type != SOCK_RAW) | 205 | if (sock->type != SOCK_RAW) |
206 | return -ESOCKTNOSUPPORT; | 206 | return -ESOCKTNOSUPPORT; |
207 | 207 | ||
208 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto); | 208 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, kern); |
209 | if (!sk) | 209 | if (!sk) |
210 | return -ENOMEM; | 210 | return -ENOMEM; |
211 | 211 | ||
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 56f9edbf3d05..5b14dcafcd08 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -1377,7 +1377,7 @@ static int hci_sock_create(struct net *net, struct socket *sock, int protocol, | |||
1377 | 1377 | ||
1378 | sock->ops = &hci_sock_ops; | 1378 | sock->ops = &hci_sock_ops; |
1379 | 1379 | ||
1380 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto); | 1380 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, kern); |
1381 | if (!sk) | 1381 | if (!sk) |
1382 | return -ENOMEM; | 1382 | return -ENOMEM; |
1383 | 1383 | ||
diff --git a/net/bluetooth/hidp/sock.c b/net/bluetooth/hidp/sock.c index cb3fdde1968a..008ba439bd62 100644 --- a/net/bluetooth/hidp/sock.c +++ b/net/bluetooth/hidp/sock.c | |||
@@ -235,7 +235,7 @@ static int hidp_sock_create(struct net *net, struct socket *sock, int protocol, | |||
235 | if (sock->type != SOCK_RAW) | 235 | if (sock->type != SOCK_RAW) |
236 | return -ESOCKTNOSUPPORT; | 236 | return -ESOCKTNOSUPPORT; |
237 | 237 | ||
238 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto); | 238 | sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hidp_proto, kern); |
239 | if (!sk) | 239 | if (!sk) |
240 | return -ENOMEM; | 240 | return -ENOMEM; |
241 | 241 | ||
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c index a7278f05eafb..244287706f91 100644 --- a/net/bluetooth/l2cap_sock.c +++ b/net/bluetooth/l2cap_sock.c | |||
@@ -43,7 +43,7 @@ static struct bt_sock_list l2cap_sk_list = { | |||
43 | static const struct proto_ops l2cap_sock_ops; | 43 | static const struct proto_ops l2cap_sock_ops; |
44 | static void l2cap_sock_init(struct sock *sk, struct sock *parent); | 44 | static void l2cap_sock_init(struct sock *sk, struct sock *parent); |
45 | static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | 45 | static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, |
46 | int proto, gfp_t prio); | 46 | int proto, gfp_t prio, int kern); |
47 | 47 | ||
48 | bool l2cap_is_socket(struct socket *sock) | 48 | bool l2cap_is_socket(struct socket *sock) |
49 | { | 49 | { |
@@ -1193,7 +1193,7 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(struct l2cap_chan *chan) | |||
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP, | 1195 | sk = l2cap_sock_alloc(sock_net(parent), NULL, BTPROTO_L2CAP, |
1196 | GFP_ATOMIC); | 1196 | GFP_ATOMIC, 0); |
1197 | if (!sk) { | 1197 | if (!sk) { |
1198 | release_sock(parent); | 1198 | release_sock(parent); |
1199 | return NULL; | 1199 | return NULL; |
@@ -1523,12 +1523,12 @@ static struct proto l2cap_proto = { | |||
1523 | }; | 1523 | }; |
1524 | 1524 | ||
1525 | static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, | 1525 | static struct sock *l2cap_sock_alloc(struct net *net, struct socket *sock, |
1526 | int proto, gfp_t prio) | 1526 | int proto, gfp_t prio, int kern) |
1527 | { | 1527 | { |
1528 | struct sock *sk; | 1528 | struct sock *sk; |
1529 | struct l2cap_chan *chan; | 1529 | struct l2cap_chan *chan; |
1530 | 1530 | ||
1531 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &l2cap_proto); | 1531 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &l2cap_proto, kern); |
1532 | if (!sk) | 1532 | if (!sk) |
1533 | return NULL; | 1533 | return NULL; |
1534 | 1534 | ||
@@ -1574,7 +1574,7 @@ static int l2cap_sock_create(struct net *net, struct socket *sock, int protocol, | |||
1574 | 1574 | ||
1575 | sock->ops = &l2cap_sock_ops; | 1575 | sock->ops = &l2cap_sock_ops; |
1576 | 1576 | ||
1577 | sk = l2cap_sock_alloc(net, sock, protocol, GFP_ATOMIC); | 1577 | sk = l2cap_sock_alloc(net, sock, protocol, GFP_ATOMIC, kern); |
1578 | if (!sk) | 1578 | if (!sk) |
1579 | return -ENOMEM; | 1579 | return -ENOMEM; |
1580 | 1580 | ||
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index 825e8fb5114b..b2338e971b33 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -269,12 +269,12 @@ static struct proto rfcomm_proto = { | |||
269 | .obj_size = sizeof(struct rfcomm_pinfo) | 269 | .obj_size = sizeof(struct rfcomm_pinfo) |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio) | 272 | static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio, int kern) |
273 | { | 273 | { |
274 | struct rfcomm_dlc *d; | 274 | struct rfcomm_dlc *d; |
275 | struct sock *sk; | 275 | struct sock *sk; |
276 | 276 | ||
277 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &rfcomm_proto); | 277 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &rfcomm_proto, kern); |
278 | if (!sk) | 278 | if (!sk) |
279 | return NULL; | 279 | return NULL; |
280 | 280 | ||
@@ -324,7 +324,7 @@ static int rfcomm_sock_create(struct net *net, struct socket *sock, | |||
324 | 324 | ||
325 | sock->ops = &rfcomm_sock_ops; | 325 | sock->ops = &rfcomm_sock_ops; |
326 | 326 | ||
327 | sk = rfcomm_sock_alloc(net, sock, protocol, GFP_ATOMIC); | 327 | sk = rfcomm_sock_alloc(net, sock, protocol, GFP_ATOMIC, kern); |
328 | if (!sk) | 328 | if (!sk) |
329 | return -ENOMEM; | 329 | return -ENOMEM; |
330 | 330 | ||
@@ -969,7 +969,7 @@ int rfcomm_connect_ind(struct rfcomm_session *s, u8 channel, struct rfcomm_dlc * | |||
969 | goto done; | 969 | goto done; |
970 | } | 970 | } |
971 | 971 | ||
972 | sk = rfcomm_sock_alloc(sock_net(parent), NULL, BTPROTO_RFCOMM, GFP_ATOMIC); | 972 | sk = rfcomm_sock_alloc(sock_net(parent), NULL, BTPROTO_RFCOMM, GFP_ATOMIC, 0); |
973 | if (!sk) | 973 | if (!sk) |
974 | goto done; | 974 | goto done; |
975 | 975 | ||
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index 4322c833e748..6b6e59dc54cf 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -460,11 +460,11 @@ static struct proto sco_proto = { | |||
460 | .obj_size = sizeof(struct sco_pinfo) | 460 | .obj_size = sizeof(struct sco_pinfo) |
461 | }; | 461 | }; |
462 | 462 | ||
463 | static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio) | 463 | static struct sock *sco_sock_alloc(struct net *net, struct socket *sock, int proto, gfp_t prio, int kern) |
464 | { | 464 | { |
465 | struct sock *sk; | 465 | struct sock *sk; |
466 | 466 | ||
467 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &sco_proto); | 467 | sk = sk_alloc(net, PF_BLUETOOTH, prio, &sco_proto, kern); |
468 | if (!sk) | 468 | if (!sk) |
469 | return NULL; | 469 | return NULL; |
470 | 470 | ||
@@ -501,7 +501,7 @@ static int sco_sock_create(struct net *net, struct socket *sock, int protocol, | |||
501 | 501 | ||
502 | sock->ops = &sco_sock_ops; | 502 | sock->ops = &sco_sock_ops; |
503 | 503 | ||
504 | sk = sco_sock_alloc(net, sock, protocol, GFP_ATOMIC); | 504 | sk = sco_sock_alloc(net, sock, protocol, GFP_ATOMIC, kern); |
505 | if (!sk) | 505 | if (!sk) |
506 | return -ENOMEM; | 506 | return -ENOMEM; |
507 | 507 | ||
@@ -1026,7 +1026,7 @@ static void sco_conn_ready(struct sco_conn *conn) | |||
1026 | bh_lock_sock(parent); | 1026 | bh_lock_sock(parent); |
1027 | 1027 | ||
1028 | sk = sco_sock_alloc(sock_net(parent), NULL, | 1028 | sk = sco_sock_alloc(sock_net(parent), NULL, |
1029 | BTPROTO_SCO, GFP_ATOMIC); | 1029 | BTPROTO_SCO, GFP_ATOMIC, 0); |
1030 | if (!sk) { | 1030 | if (!sk) { |
1031 | bh_unlock_sock(parent); | 1031 | bh_unlock_sock(parent); |
1032 | sco_conn_unlock(conn); | 1032 | sco_conn_unlock(conn); |
diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 4ec0c803aef1..78a04ebb113c 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c | |||
@@ -1047,7 +1047,7 @@ static int caif_create(struct net *net, struct socket *sock, int protocol, | |||
1047 | * is really not used at all in the net/core or socket.c but the | 1047 | * is really not used at all in the net/core or socket.c but the |
1048 | * initialization makes sure that sock->state is not uninitialized. | 1048 | * initialization makes sure that sock->state is not uninitialized. |
1049 | */ | 1049 | */ |
1050 | sk = sk_alloc(net, PF_CAIF, GFP_KERNEL, &prot); | 1050 | sk = sk_alloc(net, PF_CAIF, GFP_KERNEL, &prot, kern); |
1051 | if (!sk) | 1051 | if (!sk) |
1052 | return -ENOMEM; | 1052 | return -ENOMEM; |
1053 | 1053 | ||
diff --git a/net/can/af_can.c b/net/can/af_can.c index 32d710eaf1fc..d4d404bdfc9a 100644 --- a/net/can/af_can.c +++ b/net/can/af_can.c | |||
@@ -179,7 +179,7 @@ static int can_create(struct net *net, struct socket *sock, int protocol, | |||
179 | 179 | ||
180 | sock->ops = cp->ops; | 180 | sock->ops = cp->ops; |
181 | 181 | ||
182 | sk = sk_alloc(net, PF_CAN, GFP_KERNEL, cp->prot); | 182 | sk = sk_alloc(net, PF_CAN, GFP_KERNEL, cp->prot, kern); |
183 | if (!sk) { | 183 | if (!sk) { |
184 | err = -ENOMEM; | 184 | err = -ENOMEM; |
185 | goto errout; | 185 | goto errout; |
diff --git a/net/core/sock.c b/net/core/sock.c index e891bcf325ca..cbc3789b830c 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1396,9 +1396,10 @@ EXPORT_SYMBOL_GPL(sock_update_netprioidx); | |||
1396 | * @family: protocol family | 1396 | * @family: protocol family |
1397 | * @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc) | 1397 | * @priority: for allocation (%GFP_KERNEL, %GFP_ATOMIC, etc) |
1398 | * @prot: struct proto associated with this new sock instance | 1398 | * @prot: struct proto associated with this new sock instance |
1399 | * @kern: is this to be a kernel socket? | ||
1399 | */ | 1400 | */ |
1400 | struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | 1401 | struct sock *sk_alloc(struct net *net, int family, gfp_t priority, |
1401 | struct proto *prot) | 1402 | struct proto *prot, int kern) |
1402 | { | 1403 | { |
1403 | struct sock *sk; | 1404 | struct sock *sk; |
1404 | 1405 | ||
diff --git a/net/decnet/af_decnet.c b/net/decnet/af_decnet.c index 754484b3cd0e..675cf94e04f8 100644 --- a/net/decnet/af_decnet.c +++ b/net/decnet/af_decnet.c | |||
@@ -468,10 +468,10 @@ static struct proto dn_proto = { | |||
468 | .obj_size = sizeof(struct dn_sock), | 468 | .obj_size = sizeof(struct dn_sock), |
469 | }; | 469 | }; |
470 | 470 | ||
471 | static struct sock *dn_alloc_sock(struct net *net, struct socket *sock, gfp_t gfp) | 471 | static struct sock *dn_alloc_sock(struct net *net, struct socket *sock, gfp_t gfp, int kern) |
472 | { | 472 | { |
473 | struct dn_scp *scp; | 473 | struct dn_scp *scp; |
474 | struct sock *sk = sk_alloc(net, PF_DECnet, gfp, &dn_proto); | 474 | struct sock *sk = sk_alloc(net, PF_DECnet, gfp, &dn_proto, kern); |
475 | 475 | ||
476 | if (!sk) | 476 | if (!sk) |
477 | goto out; | 477 | goto out; |
@@ -693,7 +693,7 @@ static int dn_create(struct net *net, struct socket *sock, int protocol, | |||
693 | } | 693 | } |
694 | 694 | ||
695 | 695 | ||
696 | if ((sk = dn_alloc_sock(net, sock, GFP_KERNEL)) == NULL) | 696 | if ((sk = dn_alloc_sock(net, sock, GFP_KERNEL, kern)) == NULL) |
697 | return -ENOBUFS; | 697 | return -ENOBUFS; |
698 | 698 | ||
699 | sk->sk_protocol = protocol; | 699 | sk->sk_protocol = protocol; |
@@ -1096,7 +1096,7 @@ static int dn_accept(struct socket *sock, struct socket *newsock, int flags) | |||
1096 | 1096 | ||
1097 | cb = DN_SKB_CB(skb); | 1097 | cb = DN_SKB_CB(skb); |
1098 | sk->sk_ack_backlog--; | 1098 | sk->sk_ack_backlog--; |
1099 | newsk = dn_alloc_sock(sock_net(sk), newsock, sk->sk_allocation); | 1099 | newsk = dn_alloc_sock(sock_net(sk), newsock, sk->sk_allocation, 0); |
1100 | if (newsk == NULL) { | 1100 | if (newsk == NULL) { |
1101 | release_sock(sk); | 1101 | release_sock(sk); |
1102 | kfree_skb(skb); | 1102 | kfree_skb(skb); |
diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index b60c65f70346..7aaaf967df58 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c | |||
@@ -1014,7 +1014,7 @@ static int ieee802154_create(struct net *net, struct socket *sock, | |||
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | rc = -ENOMEM; | 1016 | rc = -ENOMEM; |
1017 | sk = sk_alloc(net, PF_IEEE802154, GFP_KERNEL, proto); | 1017 | sk = sk_alloc(net, PF_IEEE802154, GFP_KERNEL, proto, kern); |
1018 | if (!sk) | 1018 | if (!sk) |
1019 | goto out; | 1019 | goto out; |
1020 | rc = 0; | 1020 | rc = 0; |
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c index 09f4d024dfe5..e2dd9cb99d61 100644 --- a/net/ipv4/af_inet.c +++ b/net/ipv4/af_inet.c | |||
@@ -317,7 +317,7 @@ lookup_protocol: | |||
317 | WARN_ON(!answer_prot->slab); | 317 | WARN_ON(!answer_prot->slab); |
318 | 318 | ||
319 | err = -ENOBUFS; | 319 | err = -ENOBUFS; |
320 | sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot); | 320 | sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot, kern); |
321 | if (!sk) | 321 | if (!sk) |
322 | goto out; | 322 | goto out; |
323 | 323 | ||
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c index 4632afa57e05..f3866c0b6cfe 100644 --- a/net/ipv6/af_inet6.c +++ b/net/ipv6/af_inet6.c | |||
@@ -167,7 +167,7 @@ lookup_protocol: | |||
167 | WARN_ON(!answer_prot->slab); | 167 | WARN_ON(!answer_prot->slab); |
168 | 168 | ||
169 | err = -ENOBUFS; | 169 | err = -ENOBUFS; |
170 | sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot); | 170 | sk = sk_alloc(net, PF_INET6, GFP_KERNEL, answer_prot, kern); |
171 | if (!sk) | 171 | if (!sk) |
172 | goto out; | 172 | goto out; |
173 | 173 | ||
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 4ea5d7497b5f..48d0dc89b58d 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -1347,7 +1347,7 @@ static int ipx_create(struct net *net, struct socket *sock, int protocol, | |||
1347 | goto out; | 1347 | goto out; |
1348 | 1348 | ||
1349 | rc = -ENOMEM; | 1349 | rc = -ENOMEM; |
1350 | sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto); | 1350 | sk = sk_alloc(net, PF_IPX, GFP_KERNEL, &ipx_proto, kern); |
1351 | if (!sk) | 1351 | if (!sk) |
1352 | goto out; | 1352 | goto out; |
1353 | 1353 | ||
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index ee0ea25c8e7a..fae6822cc367 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -1100,7 +1100,7 @@ static int irda_create(struct net *net, struct socket *sock, int protocol, | |||
1100 | } | 1100 | } |
1101 | 1101 | ||
1102 | /* Allocate networking socket */ | 1102 | /* Allocate networking socket */ |
1103 | sk = sk_alloc(net, PF_IRDA, GFP_KERNEL, &irda_proto); | 1103 | sk = sk_alloc(net, PF_IRDA, GFP_KERNEL, &irda_proto, kern); |
1104 | if (sk == NULL) | 1104 | if (sk == NULL) |
1105 | return -ENOMEM; | 1105 | return -ENOMEM; |
1106 | 1106 | ||
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index 6daa52a18d40..918151c11348 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
@@ -535,12 +535,12 @@ static void iucv_sock_init(struct sock *sk, struct sock *parent) | |||
535 | sk->sk_type = parent->sk_type; | 535 | sk->sk_type = parent->sk_type; |
536 | } | 536 | } |
537 | 537 | ||
538 | static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio) | 538 | static struct sock *iucv_sock_alloc(struct socket *sock, int proto, gfp_t prio, int kern) |
539 | { | 539 | { |
540 | struct sock *sk; | 540 | struct sock *sk; |
541 | struct iucv_sock *iucv; | 541 | struct iucv_sock *iucv; |
542 | 542 | ||
543 | sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto); | 543 | sk = sk_alloc(&init_net, PF_IUCV, prio, &iucv_proto, kern); |
544 | if (!sk) | 544 | if (!sk) |
545 | return NULL; | 545 | return NULL; |
546 | iucv = iucv_sk(sk); | 546 | iucv = iucv_sk(sk); |
@@ -602,7 +602,7 @@ static int iucv_sock_create(struct net *net, struct socket *sock, int protocol, | |||
602 | return -ESOCKTNOSUPPORT; | 602 | return -ESOCKTNOSUPPORT; |
603 | } | 603 | } |
604 | 604 | ||
605 | sk = iucv_sock_alloc(sock, protocol, GFP_KERNEL); | 605 | sk = iucv_sock_alloc(sock, protocol, GFP_KERNEL, kern); |
606 | if (!sk) | 606 | if (!sk) |
607 | return -ENOMEM; | 607 | return -ENOMEM; |
608 | 608 | ||
@@ -1723,7 +1723,7 @@ static int iucv_callback_connreq(struct iucv_path *path, | |||
1723 | } | 1723 | } |
1724 | 1724 | ||
1725 | /* Create the new socket */ | 1725 | /* Create the new socket */ |
1726 | nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC); | 1726 | nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC, 0); |
1727 | if (!nsk) { | 1727 | if (!nsk) { |
1728 | err = pr_iucv->path_sever(path, user_data); | 1728 | err = pr_iucv->path_sever(path, user_data); |
1729 | iucv_path_free(path); | 1729 | iucv_path_free(path); |
@@ -1933,7 +1933,7 @@ static int afiucv_hs_callback_syn(struct sock *sk, struct sk_buff *skb) | |||
1933 | goto out; | 1933 | goto out; |
1934 | } | 1934 | } |
1935 | 1935 | ||
1936 | nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC); | 1936 | nsk = iucv_sock_alloc(NULL, sk->sk_type, GFP_ATOMIC, 0); |
1937 | bh_lock_sock(sk); | 1937 | bh_lock_sock(sk); |
1938 | if ((sk->sk_state != IUCV_LISTEN) || | 1938 | if ((sk->sk_state != IUCV_LISTEN) || |
1939 | sk_acceptq_is_full(sk) || | 1939 | sk_acceptq_is_full(sk) || |
diff --git a/net/key/af_key.c b/net/key/af_key.c index f0d52d721b3a..9e834ec475a9 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c | |||
@@ -149,7 +149,7 @@ static int pfkey_create(struct net *net, struct socket *sock, int protocol, | |||
149 | return -EPROTONOSUPPORT; | 149 | return -EPROTONOSUPPORT; |
150 | 150 | ||
151 | err = -ENOMEM; | 151 | err = -ENOMEM; |
152 | sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto); | 152 | sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto, kern); |
153 | if (sk == NULL) | 153 | if (sk == NULL) |
154 | goto out; | 154 | goto out; |
155 | 155 | ||
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index e9b0dec56b8e..f56c9f69e9f2 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
@@ -542,12 +542,12 @@ static int pppol2tp_backlog_recv(struct sock *sk, struct sk_buff *skb) | |||
542 | 542 | ||
543 | /* socket() handler. Initialize a new struct sock. | 543 | /* socket() handler. Initialize a new struct sock. |
544 | */ | 544 | */ |
545 | static int pppol2tp_create(struct net *net, struct socket *sock) | 545 | static int pppol2tp_create(struct net *net, struct socket *sock, int kern) |
546 | { | 546 | { |
547 | int error = -ENOMEM; | 547 | int error = -ENOMEM; |
548 | struct sock *sk; | 548 | struct sock *sk; |
549 | 549 | ||
550 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto); | 550 | sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppol2tp_sk_proto, kern); |
551 | if (!sk) | 551 | if (!sk) |
552 | goto out; | 552 | goto out; |
553 | 553 | ||
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 17a8dff06090..8fd9febaa5ba 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -168,7 +168,7 @@ static int llc_ui_create(struct net *net, struct socket *sock, int protocol, | |||
168 | 168 | ||
169 | if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) { | 169 | if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) { |
170 | rc = -ENOMEM; | 170 | rc = -ENOMEM; |
171 | sk = llc_sk_alloc(net, PF_LLC, GFP_KERNEL, &llc_proto); | 171 | sk = llc_sk_alloc(net, PF_LLC, GFP_KERNEL, &llc_proto, kern); |
172 | if (sk) { | 172 | if (sk) { |
173 | rc = 0; | 173 | rc = 0; |
174 | llc_ui_sk_init(sock, sk); | 174 | llc_ui_sk_init(sock, sk); |
diff --git a/net/llc/llc_conn.c b/net/llc/llc_conn.c index 81a61fce3afb..3e821daf9dd4 100644 --- a/net/llc/llc_conn.c +++ b/net/llc/llc_conn.c | |||
@@ -768,7 +768,7 @@ static struct sock *llc_create_incoming_sock(struct sock *sk, | |||
768 | struct llc_addr *daddr) | 768 | struct llc_addr *daddr) |
769 | { | 769 | { |
770 | struct sock *newsk = llc_sk_alloc(sock_net(sk), sk->sk_family, GFP_ATOMIC, | 770 | struct sock *newsk = llc_sk_alloc(sock_net(sk), sk->sk_family, GFP_ATOMIC, |
771 | sk->sk_prot); | 771 | sk->sk_prot, 0); |
772 | struct llc_sock *newllc, *llc = llc_sk(sk); | 772 | struct llc_sock *newllc, *llc = llc_sk(sk); |
773 | 773 | ||
774 | if (!newsk) | 774 | if (!newsk) |
@@ -931,9 +931,9 @@ static void llc_sk_init(struct sock *sk) | |||
931 | * Allocates a LLC sock and initializes it. Returns the new LLC sock | 931 | * Allocates a LLC sock and initializes it. Returns the new LLC sock |
932 | * or %NULL if there's no memory available for one | 932 | * or %NULL if there's no memory available for one |
933 | */ | 933 | */ |
934 | struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot) | 934 | struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot, int kern) |
935 | { | 935 | { |
936 | struct sock *sk = sk_alloc(net, family, priority, prot); | 936 | struct sock *sk = sk_alloc(net, family, priority, prot, kern); |
937 | 937 | ||
938 | if (!sk) | 938 | if (!sk) |
939 | goto out; | 939 | goto out; |
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index a5fff75accf8..be6665ab7f40 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -1119,14 +1119,15 @@ static struct proto netlink_proto = { | |||
1119 | }; | 1119 | }; |
1120 | 1120 | ||
1121 | static int __netlink_create(struct net *net, struct socket *sock, | 1121 | static int __netlink_create(struct net *net, struct socket *sock, |
1122 | struct mutex *cb_mutex, int protocol) | 1122 | struct mutex *cb_mutex, int protocol, |
1123 | int kern) | ||
1123 | { | 1124 | { |
1124 | struct sock *sk; | 1125 | struct sock *sk; |
1125 | struct netlink_sock *nlk; | 1126 | struct netlink_sock *nlk; |
1126 | 1127 | ||
1127 | sock->ops = &netlink_ops; | 1128 | sock->ops = &netlink_ops; |
1128 | 1129 | ||
1129 | sk = sk_alloc(net, PF_NETLINK, GFP_KERNEL, &netlink_proto); | 1130 | sk = sk_alloc(net, PF_NETLINK, GFP_KERNEL, &netlink_proto, kern); |
1130 | if (!sk) | 1131 | if (!sk) |
1131 | return -ENOMEM; | 1132 | return -ENOMEM; |
1132 | 1133 | ||
@@ -1188,7 +1189,7 @@ static int netlink_create(struct net *net, struct socket *sock, int protocol, | |||
1188 | if (err < 0) | 1189 | if (err < 0) |
1189 | goto out; | 1190 | goto out; |
1190 | 1191 | ||
1191 | err = __netlink_create(net, sock, cb_mutex, protocol); | 1192 | err = __netlink_create(net, sock, cb_mutex, protocol, kern); |
1192 | if (err < 0) | 1193 | if (err < 0) |
1193 | goto out_module; | 1194 | goto out_module; |
1194 | 1195 | ||
@@ -2515,14 +2516,12 @@ __netlink_kernel_create(struct net *net, int unit, struct module *module, | |||
2515 | 2516 | ||
2516 | if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock)) | 2517 | if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock)) |
2517 | return NULL; | 2518 | return NULL; |
2518 | |||
2519 | /* | 2519 | /* |
2520 | * We have to just have a reference on the net from sk, but don't | 2520 | * We have to just have a reference on the net from sk, but don't |
2521 | * get_net it. Besides, we cannot get and then put the net here. | 2521 | * get_net it. Besides, we cannot get and then put the net here. |
2522 | * So we create one inside init_net and the move it to net. | 2522 | * So we create one inside init_net and the move it to net. |
2523 | */ | 2523 | */ |
2524 | 2524 | if (__netlink_create(&init_net, sock, cb_mutex, unit, 0) < 0) | |
2525 | if (__netlink_create(&init_net, sock, cb_mutex, unit) < 0) | ||
2526 | goto out_sock_release_nosk; | 2525 | goto out_sock_release_nosk; |
2527 | 2526 | ||
2528 | sk = sock->sk; | 2527 | sk = sock->sk; |
diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index b987fd56c3c5..ed212ffc1d9d 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c | |||
@@ -433,7 +433,7 @@ static int nr_create(struct net *net, struct socket *sock, int protocol, | |||
433 | if (sock->type != SOCK_SEQPACKET || protocol != 0) | 433 | if (sock->type != SOCK_SEQPACKET || protocol != 0) |
434 | return -ESOCKTNOSUPPORT; | 434 | return -ESOCKTNOSUPPORT; |
435 | 435 | ||
436 | sk = sk_alloc(net, PF_NETROM, GFP_ATOMIC, &nr_proto); | 436 | sk = sk_alloc(net, PF_NETROM, GFP_ATOMIC, &nr_proto, kern); |
437 | if (sk == NULL) | 437 | if (sk == NULL) |
438 | return -ENOMEM; | 438 | return -ENOMEM; |
439 | 439 | ||
@@ -476,7 +476,7 @@ static struct sock *nr_make_new(struct sock *osk) | |||
476 | if (osk->sk_type != SOCK_SEQPACKET) | 476 | if (osk->sk_type != SOCK_SEQPACKET) |
477 | return NULL; | 477 | return NULL; |
478 | 478 | ||
479 | sk = sk_alloc(sock_net(osk), PF_NETROM, GFP_ATOMIC, osk->sk_prot); | 479 | sk = sk_alloc(sock_net(osk), PF_NETROM, GFP_ATOMIC, osk->sk_prot, 0); |
480 | if (sk == NULL) | 480 | if (sk == NULL) |
481 | return NULL; | 481 | return NULL; |
482 | 482 | ||
diff --git a/net/nfc/af_nfc.c b/net/nfc/af_nfc.c index 2277276f52bc..54e40fa47822 100644 --- a/net/nfc/af_nfc.c +++ b/net/nfc/af_nfc.c | |||
@@ -40,7 +40,7 @@ static int nfc_sock_create(struct net *net, struct socket *sock, int proto, | |||
40 | 40 | ||
41 | read_lock(&proto_tab_lock); | 41 | read_lock(&proto_tab_lock); |
42 | if (proto_tab[proto] && try_module_get(proto_tab[proto]->owner)) { | 42 | if (proto_tab[proto] && try_module_get(proto_tab[proto]->owner)) { |
43 | rc = proto_tab[proto]->create(net, sock, proto_tab[proto]); | 43 | rc = proto_tab[proto]->create(net, sock, proto_tab[proto], kern); |
44 | module_put(proto_tab[proto]->owner); | 44 | module_put(proto_tab[proto]->owner); |
45 | } | 45 | } |
46 | read_unlock(&proto_tab_lock); | 46 | read_unlock(&proto_tab_lock); |
diff --git a/net/nfc/llcp.h b/net/nfc/llcp.h index de1789e3cc82..1f68724d44d3 100644 --- a/net/nfc/llcp.h +++ b/net/nfc/llcp.h | |||
@@ -225,7 +225,7 @@ void nfc_llcp_send_to_raw_sock(struct nfc_llcp_local *local, | |||
225 | struct sk_buff *skb, u8 direction); | 225 | struct sk_buff *skb, u8 direction); |
226 | 226 | ||
227 | /* Sock API */ | 227 | /* Sock API */ |
228 | struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp); | 228 | struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp, int kern); |
229 | void nfc_llcp_sock_free(struct nfc_llcp_sock *sock); | 229 | void nfc_llcp_sock_free(struct nfc_llcp_sock *sock); |
230 | void nfc_llcp_accept_unlink(struct sock *sk); | 230 | void nfc_llcp_accept_unlink(struct sock *sk); |
231 | void nfc_llcp_accept_enqueue(struct sock *parent, struct sock *sk); | 231 | void nfc_llcp_accept_enqueue(struct sock *parent, struct sock *sk); |
diff --git a/net/nfc/llcp_core.c b/net/nfc/llcp_core.c index b18f07ccb504..98876274a1ee 100644 --- a/net/nfc/llcp_core.c +++ b/net/nfc/llcp_core.c | |||
@@ -934,7 +934,7 @@ static void nfc_llcp_recv_connect(struct nfc_llcp_local *local, | |||
934 | sock->ssap = ssap; | 934 | sock->ssap = ssap; |
935 | } | 935 | } |
936 | 936 | ||
937 | new_sk = nfc_llcp_sock_alloc(NULL, parent->sk_type, GFP_ATOMIC); | 937 | new_sk = nfc_llcp_sock_alloc(NULL, parent->sk_type, GFP_ATOMIC, 0); |
938 | if (new_sk == NULL) { | 938 | if (new_sk == NULL) { |
939 | reason = LLCP_DM_REJ; | 939 | reason = LLCP_DM_REJ; |
940 | release_sock(&sock->sk); | 940 | release_sock(&sock->sk); |
diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c index 9578bd6a4f3e..b7de0da46acd 100644 --- a/net/nfc/llcp_sock.c +++ b/net/nfc/llcp_sock.c | |||
@@ -942,12 +942,12 @@ static void llcp_sock_destruct(struct sock *sk) | |||
942 | } | 942 | } |
943 | } | 943 | } |
944 | 944 | ||
945 | struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp) | 945 | struct sock *nfc_llcp_sock_alloc(struct socket *sock, int type, gfp_t gfp, int kern) |
946 | { | 946 | { |
947 | struct sock *sk; | 947 | struct sock *sk; |
948 | struct nfc_llcp_sock *llcp_sock; | 948 | struct nfc_llcp_sock *llcp_sock; |
949 | 949 | ||
950 | sk = sk_alloc(&init_net, PF_NFC, gfp, &llcp_sock_proto); | 950 | sk = sk_alloc(&init_net, PF_NFC, gfp, &llcp_sock_proto, kern); |
951 | if (!sk) | 951 | if (!sk) |
952 | return NULL; | 952 | return NULL; |
953 | 953 | ||
@@ -993,7 +993,7 @@ void nfc_llcp_sock_free(struct nfc_llcp_sock *sock) | |||
993 | } | 993 | } |
994 | 994 | ||
995 | static int llcp_sock_create(struct net *net, struct socket *sock, | 995 | static int llcp_sock_create(struct net *net, struct socket *sock, |
996 | const struct nfc_protocol *nfc_proto) | 996 | const struct nfc_protocol *nfc_proto, int kern) |
997 | { | 997 | { |
998 | struct sock *sk; | 998 | struct sock *sk; |
999 | 999 | ||
@@ -1009,7 +1009,7 @@ static int llcp_sock_create(struct net *net, struct socket *sock, | |||
1009 | else | 1009 | else |
1010 | sock->ops = &llcp_sock_ops; | 1010 | sock->ops = &llcp_sock_ops; |
1011 | 1011 | ||
1012 | sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC); | 1012 | sk = nfc_llcp_sock_alloc(sock, sock->type, GFP_ATOMIC, kern); |
1013 | if (sk == NULL) | 1013 | if (sk == NULL) |
1014 | return -ENOMEM; | 1014 | return -ENOMEM; |
1015 | 1015 | ||
diff --git a/net/nfc/nfc.h b/net/nfc/nfc.h index a8ce80b47720..5c93e8412a26 100644 --- a/net/nfc/nfc.h +++ b/net/nfc/nfc.h | |||
@@ -30,7 +30,7 @@ struct nfc_protocol { | |||
30 | struct proto *proto; | 30 | struct proto *proto; |
31 | struct module *owner; | 31 | struct module *owner; |
32 | int (*create)(struct net *net, struct socket *sock, | 32 | int (*create)(struct net *net, struct socket *sock, |
33 | const struct nfc_protocol *nfc_proto); | 33 | const struct nfc_protocol *nfc_proto, int kern); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | struct nfc_rawsock { | 36 | struct nfc_rawsock { |
diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c index 82b4e8024778..e9a91488fe3d 100644 --- a/net/nfc/rawsock.c +++ b/net/nfc/rawsock.c | |||
@@ -334,7 +334,7 @@ static void rawsock_destruct(struct sock *sk) | |||
334 | } | 334 | } |
335 | 335 | ||
336 | static int rawsock_create(struct net *net, struct socket *sock, | 336 | static int rawsock_create(struct net *net, struct socket *sock, |
337 | const struct nfc_protocol *nfc_proto) | 337 | const struct nfc_protocol *nfc_proto, int kern) |
338 | { | 338 | { |
339 | struct sock *sk; | 339 | struct sock *sk; |
340 | 340 | ||
@@ -348,7 +348,7 @@ static int rawsock_create(struct net *net, struct socket *sock, | |||
348 | else | 348 | else |
349 | sock->ops = &rawsock_ops; | 349 | sock->ops = &rawsock_ops; |
350 | 350 | ||
351 | sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto); | 351 | sk = sk_alloc(net, PF_NFC, GFP_ATOMIC, nfc_proto->proto, kern); |
352 | if (!sk) | 352 | if (!sk) |
353 | return -ENOMEM; | 353 | return -ENOMEM; |
354 | 354 | ||
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 5102c3cc4eec..94713276a1d9 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -2832,7 +2832,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol, | |||
2832 | sock->state = SS_UNCONNECTED; | 2832 | sock->state = SS_UNCONNECTED; |
2833 | 2833 | ||
2834 | err = -ENOBUFS; | 2834 | err = -ENOBUFS; |
2835 | sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto); | 2835 | sk = sk_alloc(net, PF_PACKET, GFP_KERNEL, &packet_proto, kern); |
2836 | if (sk == NULL) | 2836 | if (sk == NULL) |
2837 | goto out; | 2837 | goto out; |
2838 | 2838 | ||
diff --git a/net/phonet/af_phonet.c b/net/phonet/af_phonet.c index 32ab87d34828..10d42f3220ab 100644 --- a/net/phonet/af_phonet.c +++ b/net/phonet/af_phonet.c | |||
@@ -97,7 +97,7 @@ static int pn_socket_create(struct net *net, struct socket *sock, int protocol, | |||
97 | goto out; | 97 | goto out; |
98 | } | 98 | } |
99 | 99 | ||
100 | sk = sk_alloc(net, PF_PHONET, GFP_KERNEL, pnp->prot); | 100 | sk = sk_alloc(net, PF_PHONET, GFP_KERNEL, pnp->prot, kern); |
101 | if (sk == NULL) { | 101 | if (sk == NULL) { |
102 | err = -ENOMEM; | 102 | err = -ENOMEM; |
103 | goto out; | 103 | goto out; |
diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 6de2aeb98a1f..850a86cde0b3 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c | |||
@@ -845,7 +845,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp) | |||
845 | } | 845 | } |
846 | 846 | ||
847 | /* Create a new to-be-accepted sock */ | 847 | /* Create a new to-be-accepted sock */ |
848 | newsk = sk_alloc(sock_net(sk), PF_PHONET, GFP_KERNEL, sk->sk_prot); | 848 | newsk = sk_alloc(sock_net(sk), PF_PHONET, GFP_KERNEL, sk->sk_prot, 0); |
849 | if (!newsk) { | 849 | if (!newsk) { |
850 | pep_reject_conn(sk, skb, PN_PIPE_ERR_OVERLOAD, GFP_KERNEL); | 850 | pep_reject_conn(sk, skb, PN_PIPE_ERR_OVERLOAD, GFP_KERNEL); |
851 | err = -ENOBUFS; | 851 | err = -ENOBUFS; |
diff --git a/net/rds/af_rds.c b/net/rds/af_rds.c index 10443377fb9d..3d83641f2861 100644 --- a/net/rds/af_rds.c +++ b/net/rds/af_rds.c | |||
@@ -440,7 +440,7 @@ static int rds_create(struct net *net, struct socket *sock, int protocol, | |||
440 | if (sock->type != SOCK_SEQPACKET || protocol) | 440 | if (sock->type != SOCK_SEQPACKET || protocol) |
441 | return -ESOCKTNOSUPPORT; | 441 | return -ESOCKTNOSUPPORT; |
442 | 442 | ||
443 | sk = sk_alloc(net, AF_RDS, GFP_ATOMIC, &rds_proto); | 443 | sk = sk_alloc(net, AF_RDS, GFP_ATOMIC, &rds_proto, kern); |
444 | if (!sk) | 444 | if (!sk) |
445 | return -ENOMEM; | 445 | return -ENOMEM; |
446 | 446 | ||
diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 8ae603069a1a..36dbc2da3661 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c | |||
@@ -520,7 +520,7 @@ static int rose_create(struct net *net, struct socket *sock, int protocol, | |||
520 | if (sock->type != SOCK_SEQPACKET || protocol != 0) | 520 | if (sock->type != SOCK_SEQPACKET || protocol != 0) |
521 | return -ESOCKTNOSUPPORT; | 521 | return -ESOCKTNOSUPPORT; |
522 | 522 | ||
523 | sk = sk_alloc(net, PF_ROSE, GFP_ATOMIC, &rose_proto); | 523 | sk = sk_alloc(net, PF_ROSE, GFP_ATOMIC, &rose_proto, kern); |
524 | if (sk == NULL) | 524 | if (sk == NULL) |
525 | return -ENOMEM; | 525 | return -ENOMEM; |
526 | 526 | ||
@@ -559,7 +559,7 @@ static struct sock *rose_make_new(struct sock *osk) | |||
559 | if (osk->sk_type != SOCK_SEQPACKET) | 559 | if (osk->sk_type != SOCK_SEQPACKET) |
560 | return NULL; | 560 | return NULL; |
561 | 561 | ||
562 | sk = sk_alloc(sock_net(osk), PF_ROSE, GFP_ATOMIC, &rose_proto); | 562 | sk = sk_alloc(sock_net(osk), PF_ROSE, GFP_ATOMIC, &rose_proto, 0); |
563 | if (sk == NULL) | 563 | if (sk == NULL) |
564 | return NULL; | 564 | return NULL; |
565 | 565 | ||
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index 0095b9a0b779..25d60ed15284 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -632,7 +632,7 @@ static int rxrpc_create(struct net *net, struct socket *sock, int protocol, | |||
632 | sock->ops = &rxrpc_rpc_ops; | 632 | sock->ops = &rxrpc_rpc_ops; |
633 | sock->state = SS_UNCONNECTED; | 633 | sock->state = SS_UNCONNECTED; |
634 | 634 | ||
635 | sk = sk_alloc(net, PF_RXRPC, GFP_KERNEL, &rxrpc_proto); | 635 | sk = sk_alloc(net, PF_RXRPC, GFP_KERNEL, &rxrpc_proto, kern); |
636 | if (!sk) | 636 | if (!sk) |
637 | return -ENOMEM; | 637 | return -ENOMEM; |
638 | 638 | ||
diff --git a/net/sctp/ipv6.c b/net/sctp/ipv6.c index 0e4198ee2370..e703ff7fed40 100644 --- a/net/sctp/ipv6.c +++ b/net/sctp/ipv6.c | |||
@@ -635,7 +635,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk, | |||
635 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); | 635 | struct ipv6_pinfo *newnp, *np = inet6_sk(sk); |
636 | struct sctp6_sock *newsctp6sk; | 636 | struct sctp6_sock *newsctp6sk; |
637 | 637 | ||
638 | newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot); | 638 | newsk = sk_alloc(sock_net(sk), PF_INET6, GFP_KERNEL, sk->sk_prot, 0); |
639 | if (!newsk) | 639 | if (!newsk) |
640 | goto out; | 640 | goto out; |
641 | 641 | ||
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c index 53b7acde9aa3..59e80356672b 100644 --- a/net/sctp/protocol.c +++ b/net/sctp/protocol.c | |||
@@ -550,7 +550,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk, | |||
550 | struct sctp_association *asoc) | 550 | struct sctp_association *asoc) |
551 | { | 551 | { |
552 | struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL, | 552 | struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL, |
553 | sk->sk_prot); | 553 | sk->sk_prot, 0); |
554 | struct inet_sock *newinet; | 554 | struct inet_sock *newinet; |
555 | 555 | ||
556 | if (!newsk) | 556 | if (!newsk) |
diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 9074b5cede38..8f3c8e2cef8e 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c | |||
@@ -342,7 +342,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock, | |||
342 | } | 342 | } |
343 | 343 | ||
344 | /* Allocate socket's protocol area */ | 344 | /* Allocate socket's protocol area */ |
345 | sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto); | 345 | sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto, kern); |
346 | if (sk == NULL) | 346 | if (sk == NULL) |
347 | return -ENOMEM; | 347 | return -ENOMEM; |
348 | 348 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 5266ea7b922b..941b3d26e3bf 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -620,7 +620,7 @@ static struct proto unix_proto = { | |||
620 | */ | 620 | */ |
621 | static struct lock_class_key af_unix_sk_receive_queue_lock_key; | 621 | static struct lock_class_key af_unix_sk_receive_queue_lock_key; |
622 | 622 | ||
623 | static struct sock *unix_create1(struct net *net, struct socket *sock) | 623 | static struct sock *unix_create1(struct net *net, struct socket *sock, int kern) |
624 | { | 624 | { |
625 | struct sock *sk = NULL; | 625 | struct sock *sk = NULL; |
626 | struct unix_sock *u; | 626 | struct unix_sock *u; |
@@ -629,7 +629,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock) | |||
629 | if (atomic_long_read(&unix_nr_socks) > 2 * get_max_files()) | 629 | if (atomic_long_read(&unix_nr_socks) > 2 * get_max_files()) |
630 | goto out; | 630 | goto out; |
631 | 631 | ||
632 | sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto); | 632 | sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto, kern); |
633 | if (!sk) | 633 | if (!sk) |
634 | goto out; | 634 | goto out; |
635 | 635 | ||
@@ -688,7 +688,7 @@ static int unix_create(struct net *net, struct socket *sock, int protocol, | |||
688 | return -ESOCKTNOSUPPORT; | 688 | return -ESOCKTNOSUPPORT; |
689 | } | 689 | } |
690 | 690 | ||
691 | return unix_create1(net, sock) ? 0 : -ENOMEM; | 691 | return unix_create1(net, sock, kern) ? 0 : -ENOMEM; |
692 | } | 692 | } |
693 | 693 | ||
694 | static int unix_release(struct socket *sock) | 694 | static int unix_release(struct socket *sock) |
@@ -1088,7 +1088,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr, | |||
1088 | err = -ENOMEM; | 1088 | err = -ENOMEM; |
1089 | 1089 | ||
1090 | /* create new sock for complete connection */ | 1090 | /* create new sock for complete connection */ |
1091 | newsk = unix_create1(sock_net(sk), NULL); | 1091 | newsk = unix_create1(sock_net(sk), NULL, 0); |
1092 | if (newsk == NULL) | 1092 | if (newsk == NULL) |
1093 | goto out; | 1093 | goto out; |
1094 | 1094 | ||
diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 2ec86e652a19..df5fc6b340f1 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c | |||
@@ -581,13 +581,14 @@ struct sock *__vsock_create(struct net *net, | |||
581 | struct socket *sock, | 581 | struct socket *sock, |
582 | struct sock *parent, | 582 | struct sock *parent, |
583 | gfp_t priority, | 583 | gfp_t priority, |
584 | unsigned short type) | 584 | unsigned short type, |
585 | int kern) | ||
585 | { | 586 | { |
586 | struct sock *sk; | 587 | struct sock *sk; |
587 | struct vsock_sock *psk; | 588 | struct vsock_sock *psk; |
588 | struct vsock_sock *vsk; | 589 | struct vsock_sock *vsk; |
589 | 590 | ||
590 | sk = sk_alloc(net, AF_VSOCK, priority, &vsock_proto); | 591 | sk = sk_alloc(net, AF_VSOCK, priority, &vsock_proto, kern); |
591 | if (!sk) | 592 | if (!sk) |
592 | return NULL; | 593 | return NULL; |
593 | 594 | ||
@@ -1866,7 +1867,7 @@ static int vsock_create(struct net *net, struct socket *sock, | |||
1866 | 1867 | ||
1867 | sock->state = SS_UNCONNECTED; | 1868 | sock->state = SS_UNCONNECTED; |
1868 | 1869 | ||
1869 | return __vsock_create(net, sock, NULL, GFP_KERNEL, 0) ? 0 : -ENOMEM; | 1870 | return __vsock_create(net, sock, NULL, GFP_KERNEL, 0, kern) ? 0 : -ENOMEM; |
1870 | } | 1871 | } |
1871 | 1872 | ||
1872 | static const struct net_proto_family vsock_family_ops = { | 1873 | static const struct net_proto_family vsock_family_ops = { |
diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index c294da095461..1f63daff3965 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c | |||
@@ -1022,7 +1022,7 @@ static int vmci_transport_recv_listen(struct sock *sk, | |||
1022 | } | 1022 | } |
1023 | 1023 | ||
1024 | pending = __vsock_create(sock_net(sk), NULL, sk, GFP_KERNEL, | 1024 | pending = __vsock_create(sock_net(sk), NULL, sk, GFP_KERNEL, |
1025 | sk->sk_type); | 1025 | sk->sk_type, 0); |
1026 | if (!pending) { | 1026 | if (!pending) { |
1027 | vmci_transport_send_reset(sk, pkt); | 1027 | vmci_transport_send_reset(sk, pkt); |
1028 | return -ENOMEM; | 1028 | return -ENOMEM; |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index c3ab230e4493..a750f330b8dd 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -515,10 +515,10 @@ static struct proto x25_proto = { | |||
515 | .obj_size = sizeof(struct x25_sock), | 515 | .obj_size = sizeof(struct x25_sock), |
516 | }; | 516 | }; |
517 | 517 | ||
518 | static struct sock *x25_alloc_socket(struct net *net) | 518 | static struct sock *x25_alloc_socket(struct net *net, int kern) |
519 | { | 519 | { |
520 | struct x25_sock *x25; | 520 | struct x25_sock *x25; |
521 | struct sock *sk = sk_alloc(net, AF_X25, GFP_ATOMIC, &x25_proto); | 521 | struct sock *sk = sk_alloc(net, AF_X25, GFP_ATOMIC, &x25_proto, kern); |
522 | 522 | ||
523 | if (!sk) | 523 | if (!sk) |
524 | goto out; | 524 | goto out; |
@@ -553,7 +553,7 @@ static int x25_create(struct net *net, struct socket *sock, int protocol, | |||
553 | goto out; | 553 | goto out; |
554 | 554 | ||
555 | rc = -ENOBUFS; | 555 | rc = -ENOBUFS; |
556 | if ((sk = x25_alloc_socket(net)) == NULL) | 556 | if ((sk = x25_alloc_socket(net, kern)) == NULL) |
557 | goto out; | 557 | goto out; |
558 | 558 | ||
559 | x25 = x25_sk(sk); | 559 | x25 = x25_sk(sk); |
@@ -602,7 +602,7 @@ static struct sock *x25_make_new(struct sock *osk) | |||
602 | if (osk->sk_type != SOCK_SEQPACKET) | 602 | if (osk->sk_type != SOCK_SEQPACKET) |
603 | goto out; | 603 | goto out; |
604 | 604 | ||
605 | if ((sk = x25_alloc_socket(sock_net(osk))) == NULL) | 605 | if ((sk = x25_alloc_socket(sock_net(osk), 0)) == NULL) |
606 | goto out; | 606 | goto out; |
607 | 607 | ||
608 | x25 = x25_sk(sk); | 608 | x25 = x25_sk(sk); |