Skip to content

Commit 11aa9c2

Browse files
ebiedermdavem330
authored andcommitted
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>
1 parent eeb1bd5 commit 11aa9c2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+109
-108
lines changed

crypto/af_alg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock)
244244
if (!type)
245245
goto unlock;
246246

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);
248248
err = -ENOMEM;
249249
if (!sk2)
250250
goto unlock;
@@ -324,7 +324,7 @@ static int alg_create(struct net *net, struct socket *sock, int protocol,
324324
return -EPROTONOSUPPORT;
325325

326326
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);
328328
if (!sk)
329329
goto out;
330330

drivers/isdn/mISDN/socket.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,14 +601,14 @@ static const struct proto_ops data_sock_ops = {
601601
};
602602

603603
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)
605605
{
606606
struct sock *sk;
607607

608608
if (sock->type != SOCK_DGRAM)
609609
return -ESOCKTNOSUPPORT;
610610

611-
sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto);
611+
sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern);
612612
if (!sk)
613613
return -ENOMEM;
614614

@@ -756,14 +756,14 @@ static const struct proto_ops base_sock_ops = {
756756

757757

758758
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)
760760
{
761761
struct sock *sk;
762762

763763
if (sock->type != SOCK_RAW)
764764
return -ESOCKTNOSUPPORT;
765765

766-
sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto);
766+
sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern);
767767
if (!sk)
768768
return -ENOMEM;
769769

@@ -785,7 +785,7 @@ mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern)
785785

786786
switch (proto) {
787787
case ISDN_P_BASE:
788-
err = base_sock_create(net, sock, proto);
788+
err = base_sock_create(net, sock, proto, kern);
789789
break;
790790
case ISDN_P_TE_S0:
791791
case ISDN_P_NT_S0:
@@ -799,7 +799,7 @@ mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern)
799799
case ISDN_P_B_L2DTMF:
800800
case ISDN_P_B_L2DSP:
801801
case ISDN_P_B_L2DSPHDLC:
802-
err = data_sock_create(net, sock, proto);
802+
err = data_sock_create(net, sock, proto, kern);
803803
break;
804804
default:
805805
return err;

drivers/net/macvtap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ static int macvtap_open(struct inode *inode, struct file *file)
476476

477477
err = -ENOMEM;
478478
q = (struct macvtap_queue *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL,
479-
&macvtap_proto);
479+
&macvtap_proto, 0);
480480
if (!q)
481481
goto out;
482482

drivers/net/ppp/pppoe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,11 @@ static struct proto pppoe_sk_proto __read_mostly = {
546546
* Initialize a new struct sock.
547547
*
548548
**********************************************************************/
549-
static int pppoe_create(struct net *net, struct socket *sock)
549+
static int pppoe_create(struct net *net, struct socket *sock, int kern)
550550
{
551551
struct sock *sk;
552552

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);
554554
if (!sk)
555555
return -ENOMEM;
556556

drivers/net/ppp/pppox.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static int pppox_create(struct net *net, struct socket *sock, int protocol,
118118
!try_module_get(pppox_protos[protocol]->owner))
119119
goto out;
120120

121-
rc = pppox_protos[protocol]->create(net, sock);
121+
rc = pppox_protos[protocol]->create(net, sock, kern);
122122

123123
module_put(pppox_protos[protocol]->owner);
124124
out:

drivers/net/ppp/pptp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,14 +561,14 @@ static void pptp_sock_destruct(struct sock *sk)
561561
skb_queue_purge(&sk->sk_receive_queue);
562562
}
563563

564-
static int pptp_create(struct net *net, struct socket *sock)
564+
static int pptp_create(struct net *net, struct socket *sock, int kern)
565565
{
566566
int error = -ENOMEM;
567567
struct sock *sk;
568568
struct pppox_sock *po;
569569
struct pptp_opt *opt;
570570

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);
572572
if (!sk)
573573
goto out;
574574

drivers/net/tun.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2148,7 +2148,7 @@ static int tun_chr_open(struct inode *inode, struct file * file)
21482148
DBG1(KERN_INFO, "tunX: tun_chr_open\n");
21492149

21502150
tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL,
2151-
&tun_proto);
2151+
&tun_proto, 0);
21522152
if (!tfile)
21532153
return -ENOMEM;
21542154
RCU_INIT_POINTER(tfile->tun, NULL);

include/linux/if_pppox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ static inline struct sock *sk_pppox(struct pppox_sock *po)
7474
struct module;
7575

7676
struct pppox_proto {
77-
int (*create)(struct net *net, struct socket *sock);
77+
int (*create)(struct net *net, struct socket *sock, int kern);
7878
int (*ioctl)(struct socket *sock, unsigned int cmd,
7979
unsigned long arg);
8080
struct module *owner;

include/net/af_vsock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ void vsock_pending_work(struct work_struct *work);
7474
struct sock *__vsock_create(struct net *net,
7575
struct socket *sock,
7676
struct sock *parent,
77-
gfp_t priority, unsigned short type);
77+
gfp_t priority, unsigned short type, int kern);
7878

7979
/**** TRANSPORT ****/
8080

include/net/llc_conn.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb)
9696
}
9797

9898
struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority,
99-
struct proto *prot);
99+
struct proto *prot, int kern);
100100
void llc_sk_free(struct sock *sk);
101101

102102
void llc_sk_reset(struct sock *sk);

0 commit comments

Comments
 (0)