aboutsummaryrefslogtreecommitdiffstats
path: root/net/key
diff options
context:
space:
mode:
Diffstat (limited to 'net/key')
-rw-r--r--net/key/af_key.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/key/af_key.c b/net/key/af_key.c
index 5b802bbb856e..ff5c3d03005e 100644
--- a/net/key/af_key.c
+++ b/net/key/af_key.c
@@ -136,11 +136,14 @@ static struct proto key_proto = {
136 .obj_size = sizeof(struct pfkey_sock), 136 .obj_size = sizeof(struct pfkey_sock),
137}; 137};
138 138
139static int pfkey_create(struct socket *sock, int protocol) 139static int pfkey_create(struct net *net, struct socket *sock, int protocol)
140{ 140{
141 struct sock *sk; 141 struct sock *sk;
142 int err; 142 int err;
143 143
144 if (net != &init_net)
145 return -EAFNOSUPPORT;
146
144 if (!capable(CAP_NET_ADMIN)) 147 if (!capable(CAP_NET_ADMIN))
145 return -EPERM; 148 return -EPERM;
146 if (sock->type != SOCK_RAW) 149 if (sock->type != SOCK_RAW)
@@ -149,7 +152,7 @@ static int pfkey_create(struct socket *sock, int protocol)
149 return -EPROTONOSUPPORT; 152 return -EPROTONOSUPPORT;
150 153
151 err = -ENOMEM; 154 err = -ENOMEM;
152 sk = sk_alloc(PF_KEY, GFP_KERNEL, &key_proto, 1); 155 sk = sk_alloc(net, PF_KEY, GFP_KERNEL, &key_proto, 1);
153 if (sk == NULL) 156 if (sk == NULL)
154 goto out; 157 goto out;
155 158