diff options
Diffstat (limited to 'net/x25')
-rw-r--r-- | net/x25/af_x25.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 479927cb45ca..2e9931571a4d 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -466,10 +466,10 @@ static struct proto x25_proto = { | |||
466 | .obj_size = sizeof(struct x25_sock), | 466 | .obj_size = sizeof(struct x25_sock), |
467 | }; | 467 | }; |
468 | 468 | ||
469 | static struct sock *x25_alloc_socket(void) | 469 | static struct sock *x25_alloc_socket(struct net *net) |
470 | { | 470 | { |
471 | struct x25_sock *x25; | 471 | struct x25_sock *x25; |
472 | struct sock *sk = sk_alloc(AF_X25, GFP_ATOMIC, &x25_proto, 1); | 472 | struct sock *sk = sk_alloc(net, AF_X25, GFP_ATOMIC, &x25_proto, 1); |
473 | 473 | ||
474 | if (!sk) | 474 | if (!sk) |
475 | goto out; | 475 | goto out; |
@@ -485,17 +485,20 @@ out: | |||
485 | return sk; | 485 | return sk; |
486 | } | 486 | } |
487 | 487 | ||
488 | static int x25_create(struct socket *sock, int protocol) | 488 | static int x25_create(struct net *net, struct socket *sock, int protocol) |
489 | { | 489 | { |
490 | struct sock *sk; | 490 | struct sock *sk; |
491 | struct x25_sock *x25; | 491 | struct x25_sock *x25; |
492 | int rc = -ESOCKTNOSUPPORT; | 492 | int rc = -ESOCKTNOSUPPORT; |
493 | 493 | ||
494 | if (net != &init_net) | ||
495 | return -EAFNOSUPPORT; | ||
496 | |||
494 | if (sock->type != SOCK_SEQPACKET || protocol) | 497 | if (sock->type != SOCK_SEQPACKET || protocol) |
495 | goto out; | 498 | goto out; |
496 | 499 | ||
497 | rc = -ENOMEM; | 500 | rc = -ENOMEM; |
498 | if ((sk = x25_alloc_socket()) == NULL) | 501 | if ((sk = x25_alloc_socket(net)) == NULL) |
499 | goto out; | 502 | goto out; |
500 | 503 | ||
501 | x25 = x25_sk(sk); | 504 | x25 = x25_sk(sk); |
@@ -543,7 +546,7 @@ static struct sock *x25_make_new(struct sock *osk) | |||
543 | if (osk->sk_type != SOCK_SEQPACKET) | 546 | if (osk->sk_type != SOCK_SEQPACKET) |
544 | goto out; | 547 | goto out; |
545 | 548 | ||
546 | if ((sk = x25_alloc_socket()) == NULL) | 549 | if ((sk = x25_alloc_socket(osk->sk_net)) == NULL) |
547 | goto out; | 550 | goto out; |
548 | 551 | ||
549 | x25 = x25_sk(sk); | 552 | x25 = x25_sk(sk); |