diff options
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/af_netlink.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 3982f13dab17..406a493300d8 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -384,15 +384,15 @@ static struct proto netlink_proto = { | |||
384 | .obj_size = sizeof(struct netlink_sock), | 384 | .obj_size = sizeof(struct netlink_sock), |
385 | }; | 385 | }; |
386 | 386 | ||
387 | static int __netlink_create(struct socket *sock, struct mutex *cb_mutex, | 387 | static int __netlink_create(struct net *net, struct socket *sock, |
388 | int protocol) | 388 | struct mutex *cb_mutex, int protocol) |
389 | { | 389 | { |
390 | struct sock *sk; | 390 | struct sock *sk; |
391 | struct netlink_sock *nlk; | 391 | struct netlink_sock *nlk; |
392 | 392 | ||
393 | sock->ops = &netlink_ops; | 393 | sock->ops = &netlink_ops; |
394 | 394 | ||
395 | sk = sk_alloc(PF_NETLINK, GFP_KERNEL, &netlink_proto, 1); | 395 | sk = sk_alloc(net, PF_NETLINK, GFP_KERNEL, &netlink_proto, 1); |
396 | if (!sk) | 396 | if (!sk) |
397 | return -ENOMEM; | 397 | return -ENOMEM; |
398 | 398 | ||
@@ -412,13 +412,16 @@ static int __netlink_create(struct socket *sock, struct mutex *cb_mutex, | |||
412 | return 0; | 412 | return 0; |
413 | } | 413 | } |
414 | 414 | ||
415 | static int netlink_create(struct socket *sock, int protocol) | 415 | static int netlink_create(struct net *net, struct socket *sock, int protocol) |
416 | { | 416 | { |
417 | struct module *module = NULL; | 417 | struct module *module = NULL; |
418 | struct mutex *cb_mutex; | 418 | struct mutex *cb_mutex; |
419 | struct netlink_sock *nlk; | 419 | struct netlink_sock *nlk; |
420 | int err = 0; | 420 | int err = 0; |
421 | 421 | ||
422 | if (net != &init_net) | ||
423 | return -EAFNOSUPPORT; | ||
424 | |||
422 | sock->state = SS_UNCONNECTED; | 425 | sock->state = SS_UNCONNECTED; |
423 | 426 | ||
424 | if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) | 427 | if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) |
@@ -441,7 +444,7 @@ static int netlink_create(struct socket *sock, int protocol) | |||
441 | cb_mutex = nl_table[protocol].cb_mutex; | 444 | cb_mutex = nl_table[protocol].cb_mutex; |
442 | netlink_unlock_table(); | 445 | netlink_unlock_table(); |
443 | 446 | ||
444 | if ((err = __netlink_create(sock, cb_mutex, protocol)) < 0) | 447 | if ((err = __netlink_create(net, sock, cb_mutex, protocol)) < 0) |
445 | goto out_module; | 448 | goto out_module; |
446 | 449 | ||
447 | nlk = nlk_sk(sock->sk); | 450 | nlk = nlk_sk(sock->sk); |
@@ -1318,7 +1321,7 @@ netlink_kernel_create(int unit, unsigned int groups, | |||
1318 | if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock)) | 1321 | if (sock_create_lite(PF_NETLINK, SOCK_DGRAM, unit, &sock)) |
1319 | return NULL; | 1322 | return NULL; |
1320 | 1323 | ||
1321 | if (__netlink_create(sock, cb_mutex, unit) < 0) | 1324 | if (__netlink_create(&init_net, sock, cb_mutex, unit) < 0) |
1322 | goto out_sock_release; | 1325 | goto out_sock_release; |
1323 | 1326 | ||
1324 | if (groups < 32) | 1327 | if (groups < 32) |