]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/tipc/socket.c
Driver Core: fix bug in device_rename() for SYSFS_DEPRECATED=y
[linux-2.6-omap-h63xx.git] / net / tipc / socket.c
index 84110172031ef6bfa69716a90ca4bbda6b48e3f4..e36b4b5a5222320644fd1d7fe35c06bfe982e7f0 100644 (file)
@@ -162,13 +162,16 @@ static void advance_queue(struct tipc_sock *tsock)
  *
  * Returns 0 on success, errno otherwise
  */
-static int tipc_create(struct socket *sock, int protocol)
+static int tipc_create(struct net *net, struct socket *sock, int protocol)
 {
        struct tipc_sock *tsock;
        struct tipc_port *port;
        struct sock *sk;
        u32 ref;
 
+       if (net != &init_net)
+               return -EAFNOSUPPORT;
+
        if (unlikely(protocol != 0))
                return -EPROTONOSUPPORT;
 
@@ -198,7 +201,7 @@ static int tipc_create(struct socket *sock, int protocol)
                return -EPROTOTYPE;
        }
 
-       sk = sk_alloc(AF_TIPC, GFP_KERNEL, &tipc_proto, 1);
+       sk = sk_alloc(net, AF_TIPC, GFP_KERNEL, &tipc_proto, 1);
        if (!sk) {
                tipc_deleteport(ref);
                return -ENOMEM;
@@ -1372,7 +1375,7 @@ static int accept(struct socket *sock, struct socket *newsock, int flags)
        }
        buf = skb_peek(&sock->sk->sk_receive_queue);
 
-       res = tipc_create(newsock, 0);
+       res = tipc_create(sock->sk->sk_net, newsock, 0);
        if (!res) {
                struct tipc_sock *new_tsock = tipc_sk(newsock->sk);
                struct tipc_portid id;