You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
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>
This commit is contained in:
committed by
David S. Miller
parent
eeb1bd5c40
commit
11aa9c28b4
+2
-2
@@ -244,7 +244,7 @@ int af_alg_accept(struct sock *sk, struct socket *newsock)
|
||||
if (!type)
|
||||
goto unlock;
|
||||
|
||||
sk2 = sk_alloc(sock_net(sk), PF_ALG, GFP_KERNEL, &alg_proto);
|
||||
sk2 = sk_alloc(sock_net(sk), PF_ALG, GFP_KERNEL, &alg_proto, 0);
|
||||
err = -ENOMEM;
|
||||
if (!sk2)
|
||||
goto unlock;
|
||||
@@ -324,7 +324,7 @@ static int alg_create(struct net *net, struct socket *sock, int protocol,
|
||||
return -EPROTONOSUPPORT;
|
||||
|
||||
err = -ENOMEM;
|
||||
sk = sk_alloc(net, PF_ALG, GFP_KERNEL, &alg_proto);
|
||||
sk = sk_alloc(net, PF_ALG, GFP_KERNEL, &alg_proto, kern);
|
||||
if (!sk)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -601,14 +601,14 @@ static const struct proto_ops data_sock_ops = {
|
||||
};
|
||||
|
||||
static int
|
||||
data_sock_create(struct net *net, struct socket *sock, int protocol)
|
||||
data_sock_create(struct net *net, struct socket *sock, int protocol, int kern)
|
||||
{
|
||||
struct sock *sk;
|
||||
|
||||
if (sock->type != SOCK_DGRAM)
|
||||
return -ESOCKTNOSUPPORT;
|
||||
|
||||
sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto);
|
||||
sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern);
|
||||
if (!sk)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -756,14 +756,14 @@ static const struct proto_ops base_sock_ops = {
|
||||
|
||||
|
||||
static int
|
||||
base_sock_create(struct net *net, struct socket *sock, int protocol)
|
||||
base_sock_create(struct net *net, struct socket *sock, int protocol, int kern)
|
||||
{
|
||||
struct sock *sk;
|
||||
|
||||
if (sock->type != SOCK_RAW)
|
||||
return -ESOCKTNOSUPPORT;
|
||||
|
||||
sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto);
|
||||
sk = sk_alloc(net, PF_ISDN, GFP_KERNEL, &mISDN_proto, kern);
|
||||
if (!sk)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -785,7 +785,7 @@ mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern)
|
||||
|
||||
switch (proto) {
|
||||
case ISDN_P_BASE:
|
||||
err = base_sock_create(net, sock, proto);
|
||||
err = base_sock_create(net, sock, proto, kern);
|
||||
break;
|
||||
case ISDN_P_TE_S0:
|
||||
case ISDN_P_NT_S0:
|
||||
@@ -799,7 +799,7 @@ mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern)
|
||||
case ISDN_P_B_L2DTMF:
|
||||
case ISDN_P_B_L2DSP:
|
||||
case ISDN_P_B_L2DSPHDLC:
|
||||
err = data_sock_create(net, sock, proto);
|
||||
err = data_sock_create(net, sock, proto, kern);
|
||||
break;
|
||||
default:
|
||||
return err;
|
||||
|
||||
@@ -476,7 +476,7 @@ static int macvtap_open(struct inode *inode, struct file *file)
|
||||
|
||||
err = -ENOMEM;
|
||||
q = (struct macvtap_queue *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL,
|
||||
&macvtap_proto);
|
||||
&macvtap_proto, 0);
|
||||
if (!q)
|
||||
goto out;
|
||||
|
||||
|
||||
@@ -546,11 +546,11 @@ static struct proto pppoe_sk_proto __read_mostly = {
|
||||
* Initialize a new struct sock.
|
||||
*
|
||||
**********************************************************************/
|
||||
static int pppoe_create(struct net *net, struct socket *sock)
|
||||
static int pppoe_create(struct net *net, struct socket *sock, int kern)
|
||||
{
|
||||
struct sock *sk;
|
||||
|
||||
sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto);
|
||||
sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto, kern);
|
||||
if (!sk)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ static int pppox_create(struct net *net, struct socket *sock, int protocol,
|
||||
!try_module_get(pppox_protos[protocol]->owner))
|
||||
goto out;
|
||||
|
||||
rc = pppox_protos[protocol]->create(net, sock);
|
||||
rc = pppox_protos[protocol]->create(net, sock, kern);
|
||||
|
||||
module_put(pppox_protos[protocol]->owner);
|
||||
out:
|
||||
|
||||
@@ -561,14 +561,14 @@ static void pptp_sock_destruct(struct sock *sk)
|
||||
skb_queue_purge(&sk->sk_receive_queue);
|
||||
}
|
||||
|
||||
static int pptp_create(struct net *net, struct socket *sock)
|
||||
static int pptp_create(struct net *net, struct socket *sock, int kern)
|
||||
{
|
||||
int error = -ENOMEM;
|
||||
struct sock *sk;
|
||||
struct pppox_sock *po;
|
||||
struct pptp_opt *opt;
|
||||
|
||||
sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pptp_sk_proto);
|
||||
sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pptp_sk_proto, kern);
|
||||
if (!sk)
|
||||
goto out;
|
||||
|
||||
|
||||
+1
-1
@@ -2148,7 +2148,7 @@ static int tun_chr_open(struct inode *inode, struct file * file)
|
||||
DBG1(KERN_INFO, "tunX: tun_chr_open\n");
|
||||
|
||||
tfile = (struct tun_file *)sk_alloc(net, AF_UNSPEC, GFP_KERNEL,
|
||||
&tun_proto);
|
||||
&tun_proto, 0);
|
||||
if (!tfile)
|
||||
return -ENOMEM;
|
||||
RCU_INIT_POINTER(tfile->tun, NULL);
|
||||
|
||||
@@ -74,7 +74,7 @@ static inline struct sock *sk_pppox(struct pppox_sock *po)
|
||||
struct module;
|
||||
|
||||
struct pppox_proto {
|
||||
int (*create)(struct net *net, struct socket *sock);
|
||||
int (*create)(struct net *net, struct socket *sock, int kern);
|
||||
int (*ioctl)(struct socket *sock, unsigned int cmd,
|
||||
unsigned long arg);
|
||||
struct module *owner;
|
||||
|
||||
@@ -74,7 +74,7 @@ void vsock_pending_work(struct work_struct *work);
|
||||
struct sock *__vsock_create(struct net *net,
|
||||
struct socket *sock,
|
||||
struct sock *parent,
|
||||
gfp_t priority, unsigned short type);
|
||||
gfp_t priority, unsigned short type, int kern);
|
||||
|
||||
/**** TRANSPORT ****/
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ static __inline__ char llc_backlog_type(struct sk_buff *skb)
|
||||
}
|
||||
|
||||
struct sock *llc_sk_alloc(struct net *net, int family, gfp_t priority,
|
||||
struct proto *prot);
|
||||
struct proto *prot, int kern);
|
||||
void llc_sk_free(struct sock *sk);
|
||||
|
||||
void llc_sk_reset(struct sock *sk);
|
||||
|
||||
+1
-1
@@ -1514,7 +1514,7 @@ static inline void unlock_sock_fast(struct sock *sk, bool slow)
|
||||
|
||||
|
||||
struct sock *sk_alloc(struct net *net, int family, gfp_t priority,
|
||||
struct proto *prot);
|
||||
struct proto *prot, int kern);
|
||||
void sk_free(struct sock *sk);
|
||||
void sk_release_kernel(struct sock *sk);
|
||||
struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority);
|
||||
|
||||
+1
-1
@@ -1030,7 +1030,7 @@ static int atalk_create(struct net *net, struct socket *sock, int protocol,
|
||||
if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM)
|
||||
goto out;
|
||||
rc = -ENOMEM;
|
||||
sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto);
|
||||
sk = sk_alloc(net, PF_APPLETALK, GFP_KERNEL, &ddp_proto, kern);
|
||||
if (!sk)
|
||||
goto out;
|
||||
rc = 0;
|
||||
|
||||
+2
-2
@@ -141,7 +141,7 @@ static struct proto vcc_proto = {
|
||||
.release_cb = vcc_release_cb,
|
||||
};
|
||||
|
||||
int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
|
||||
int vcc_create(struct net *net, struct socket *sock, int protocol, int family, int kern)
|
||||
{
|
||||
struct sock *sk;
|
||||
struct atm_vcc *vcc;
|
||||
@@ -149,7 +149,7 @@ int vcc_create(struct net *net, struct socket *sock, int protocol, int family)
|
||||
sock->sk = NULL;
|
||||
if (sock->type == SOCK_STREAM)
|
||||
return -EINVAL;
|
||||
sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto);
|
||||
sk = sk_alloc(net, family, GFP_KERNEL, &vcc_proto, kern);
|
||||
if (!sk)
|
||||
return -ENOMEM;
|
||||
sock_init_data(sock, sk);
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
#include <linux/poll.h> /* for poll_table */
|
||||
|
||||
|
||||
int vcc_create(struct net *net, struct socket *sock, int protocol, int family);
|
||||
int vcc_create(struct net *net, struct socket *sock, int protocol, int family, int kern);
|
||||
int vcc_release(struct socket *sock);
|
||||
int vcc_connect(struct socket *sock, int itf, short vpi, int vci);
|
||||
int vcc_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ static int pvc_create(struct net *net, struct socket *sock, int protocol,
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
sock->ops = &pvc_proto_ops;
|
||||
return vcc_create(net, sock, protocol, PF_ATMPVC);
|
||||
return vcc_create(net, sock, protocol, PF_ATMPVC, kern);
|
||||
}
|
||||
|
||||
static const struct net_proto_family pvc_family_ops = {
|
||||
|
||||
+1
-1
@@ -660,7 +660,7 @@ static int svc_create(struct net *net, struct socket *sock, int protocol,
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
sock->ops = &svc_proto_ops;
|
||||
error = vcc_create(net, sock, protocol, AF_ATMSVC);
|
||||
error = vcc_create(net, sock, protocol, AF_ATMSVC, kern);
|
||||
if (error)
|
||||
return error;
|
||||
ATM_SD(sock)->local.sas_family = AF_ATMSVC;
|
||||
|
||||
+2
-2
@@ -855,7 +855,7 @@ static int ax25_create(struct net *net, struct socket *sock, int protocol,
|
||||
return -ESOCKTNOSUPPORT;
|
||||
}
|
||||
|
||||
sk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto);
|
||||
sk = sk_alloc(net, PF_AX25, GFP_ATOMIC, &ax25_proto, kern);
|
||||
if (sk == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -881,7 +881,7 @@ struct sock *ax25_make_new(struct sock *osk, struct ax25_dev *ax25_dev)
|
||||
struct sock *sk;
|
||||
ax25_cb *ax25, *oax25;
|
||||
|
||||
sk = sk_alloc(sock_net(osk), PF_AX25, GFP_ATOMIC, osk->sk_prot);
|
||||
sk = sk_alloc(sock_net(osk), PF_AX25, GFP_ATOMIC, osk->sk_prot, 0);
|
||||
if (sk == NULL)
|
||||
return NULL;
|
||||
|
||||
|
||||
@@ -202,7 +202,7 @@ static int bnep_sock_create(struct net *net, struct socket *sock, int protocol,
|
||||
if (sock->type != SOCK_RAW)
|
||||
return -ESOCKTNOSUPPORT;
|
||||
|
||||
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto);
|
||||
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &bnep_proto, kern);
|
||||
if (!sk)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ static int cmtp_sock_create(struct net *net, struct socket *sock, int protocol,
|
||||
if (sock->type != SOCK_RAW)
|
||||
return -ESOCKTNOSUPPORT;
|
||||
|
||||
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto);
|
||||
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &cmtp_proto, kern);
|
||||
if (!sk)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -1377,7 +1377,7 @@ static int hci_sock_create(struct net *net, struct socket *sock, int protocol,
|
||||
|
||||
sock->ops = &hci_sock_ops;
|
||||
|
||||
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto);
|
||||
sk = sk_alloc(net, PF_BLUETOOTH, GFP_ATOMIC, &hci_sk_proto, kern);
|
||||
if (!sk)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user