@@ -533,7 +533,8 @@ static struct proto pppoe_sk_proto __read_mostly = {
* Initialize a new struct sock.
*
**********************************************************************/
-static int pppoe_create(struct net *net, struct socket *sock, int kern)
+static int pppoe_create(struct net *net, struct socket *sock,
+ bool kern, bool hold_net)
{
struct sock *sk;
@@ -126,7 +126,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, kern);
+ rc = pppox_protos[protocol]->create(net, sock, kern, hold_net);
module_put(pppox_protos[protocol]->owner);
out:
@@ -538,7 +538,8 @@ static void pptp_sock_destruct(struct sock *sk)
dst_release(rcu_dereference_protected(sk->sk_dst_cache, 1));
}
-static int pptp_create(struct net *net, struct socket *sock, int kern)
+static int pptp_create(struct net *net, struct socket *sock,
+ bool kern, bool hold_net)
{
int error = -ENOMEM;
struct sock *sk;
@@ -68,7 +68,8 @@ static inline struct sock *sk_pppox(struct pppox_sock *po)
struct module;
struct pppox_proto {
- int (*create)(struct net *net, struct socket *sock, int kern);
+ int (*create)(struct net *net, struct socket *sock,
+ bool kern, bool hold_net);
int (*ioctl)(struct socket *sock, unsigned int cmd,
unsigned long arg);
struct module *owner;
@@ -477,7 +477,8 @@ static int pppol2tp_backlog_recv(struct sock *sk, struct sk_buff *skb)
/* socket() handler. Initialize a new struct sock.
*/
-static int pppol2tp_create(struct net *net, struct socket *sock, int kern)
+static int pppol2tp_create(struct net *net, struct socket *sock,
+ bool kern, bool hold_net)
{
int error = -ENOMEM;
struct sock *sk;
We will introduce a new API to create a kernel socket with netns refcnt held. Then, sk_alloc() need the hold_net flag passed to pppox_create(). Let's pass it down to struct pppox_proto.create(). While at it, we convert the kern flag to boolean. Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com> --- drivers/net/ppp/pppoe.c | 3 ++- drivers/net/ppp/pppox.c | 2 +- drivers/net/ppp/pptp.c | 3 ++- include/linux/if_pppox.h | 3 ++- net/l2tp/l2tp_ppp.c | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-)