aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/svc.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-10-09 02:24:22 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:49:07 -0400
commit1b8d7ae42d02e483ad94035cca851e4f7fbecb40 (patch)
tree81f8cc0ee49ef99cc67dfed3dc7b7ecb510abf8b /net/atm/svc.c
parent457c4cbc5a3dde259d2a1f15d5f9785290397267 (diff)
[NET]: Make socket creation namespace safe.
This patch passes in the namespace a new socket should be created in and has the socket code do the appropriate reference counting. By virtue of this all socket create methods are touched. In addition the socket create methods are modified so that they will fail if you attempt to create a socket in a non-default network namespace. Failing if we attempt to create a socket outside of the default network namespace ensures that as we incrementally make the network stack network namespace aware we will not export functionality that someone has not audited and made certain is network namespace safe. Allowing us to partially enable network namespaces before all of the exotic protocols are supported. Any protocol layers I have missed will fail to compile because I now pass an extra parameter into the socket creation code. [ Integrated AF_IUCV build fixes from Andrew Morton... -DaveM ] Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/svc.c')
-rw-r--r--net/atm/svc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/atm/svc.c b/net/atm/svc.c
index 53d04c7992cf..daf9a48a7db0 100644
--- a/net/atm/svc.c
+++ b/net/atm/svc.c
@@ -25,7 +25,7 @@
25#include "signaling.h" 25#include "signaling.h"
26#include "addr.h" 26#include "addr.h"
27 27
28static int svc_create(struct socket *sock,int protocol); 28static int svc_create(struct net *net, struct socket *sock,int protocol);
29 29
30/* 30/*
31 * Note: since all this is still nicely synchronized with the signaling demon, 31 * Note: since all this is still nicely synchronized with the signaling demon,
@@ -326,7 +326,7 @@ static int svc_accept(struct socket *sock,struct socket *newsock,int flags)
326 326
327 lock_sock(sk); 327 lock_sock(sk);
328 328
329 error = svc_create(newsock,0); 329 error = svc_create(sk->sk_net, newsock,0);
330 if (error) 330 if (error)
331 goto out; 331 goto out;
332 332
@@ -627,12 +627,15 @@ static const struct proto_ops svc_proto_ops = {
627}; 627};
628 628
629 629
630static int svc_create(struct socket *sock,int protocol) 630static int svc_create(struct net *net, struct socket *sock,int protocol)
631{ 631{
632 int error; 632 int error;
633 633
634 if (net != &init_net)
635 return -EAFNOSUPPORT;
636
634 sock->ops = &svc_proto_ops; 637 sock->ops = &svc_proto_ops;
635 error = vcc_create(sock, protocol, AF_ATMSVC); 638 error = vcc_create(net, sock, protocol, AF_ATMSVC);
636 if (error) return error; 639 if (error) return error;
637 ATM_SD(sock)->local.sas_family = AF_ATMSVC; 640 ATM_SD(sock)->local.sas_family = AF_ATMSVC;
638 ATM_SD(sock)->remote.sas_family = AF_ATMSVC; 641 ATM_SD(sock)->remote.sas_family = AF_ATMSVC;