aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:40:14 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-11 22:40:14 -0400
commit038a5008b2f395c85e6e71d6ddf3c684e7c405b0 (patch)
tree4735eab577e97e5a22c3141e3f60071c8065585e /net/unix
parentdd6d1844af33acb4edd0a40b1770d091a22c94be (diff)
parent266918303226cceac7eca38ced30f15f277bd89c (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (867 commits) [SKY2]: status polling loop (post merge) [NET]: Fix NAPI completion handling in some drivers. [TCP]: Limit processing lost_retrans loop to work-to-do cases [TCP]: Fix lost_retrans loop vs fastpath problems [TCP]: No need to re-count fackets_out/sacked_out at RTO [TCP]: Extract tcp_match_queue_to_sack from sacktag code [TCP]: Kill almost unused variable pcount from sacktag [TCP]: Fix mark_head_lost to ignore R-bit when trying to mark L [TCP]: Add bytes_acked (ABC) clearing to FRTO too [IPv6]: Update setsockopt(IPV6_MULTICAST_IF) to support RFC 3493, try2 [NETFILTER]: x_tables: add missing ip6t_modulename aliases [NETFILTER]: nf_conntrack_tcp: fix connection reopening [QETH]: fix qeth_main.c [NETLINK]: fib_frontend build fixes [IPv6]: Export userland ND options through netlink (RDNSS support) [9P]: build fix with !CONFIG_SYSCTL [NET]: Fix dev_put() and dev_hold() comments [NET]: make netlink user -> kernel interface synchronious [NET]: unify netlink kernel socket recognition [NET]: cleanup 3rd argument in netlink_sendskb ... Fix up conflicts manually in Documentation/feature-removal-schedule.txt and my new least favourite crap, the "mod_devicetable" support in the files include/linux/mod_devicetable.h and scripts/mod/file2alias.c. (The latter files seem to be explicitly _designed_ to get conflicts when different subsystems work with them - that have an absolutely horrid lack of subsystem separation!) Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/af_unix.c38
1 files changed, 12 insertions, 26 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a05c34260e70..2b57eaf66abc 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -103,6 +103,7 @@
103#include <asm/uaccess.h> 103#include <asm/uaccess.h>
104#include <linux/skbuff.h> 104#include <linux/skbuff.h>
105#include <linux/netdevice.h> 105#include <linux/netdevice.h>
106#include <net/net_namespace.h>
106#include <net/sock.h> 107#include <net/sock.h>
107#include <net/tcp_states.h> 108#include <net/tcp_states.h>
108#include <net/af_unix.h> 109#include <net/af_unix.h>
@@ -593,7 +594,7 @@ static struct proto unix_proto = {
593 */ 594 */
594static struct lock_class_key af_unix_sk_receive_queue_lock_key; 595static struct lock_class_key af_unix_sk_receive_queue_lock_key;
595 596
596static struct sock * unix_create1(struct socket *sock) 597static struct sock * unix_create1(struct net *net, struct socket *sock)
597{ 598{
598 struct sock *sk = NULL; 599 struct sock *sk = NULL;
599 struct unix_sock *u; 600 struct unix_sock *u;
@@ -601,7 +602,7 @@ static struct sock * unix_create1(struct socket *sock)
601 if (atomic_read(&unix_nr_socks) >= 2*get_max_files()) 602 if (atomic_read(&unix_nr_socks) >= 2*get_max_files())
602 goto out; 603 goto out;
603 604
604 sk = sk_alloc(PF_UNIX, GFP_KERNEL, &unix_proto, 1); 605 sk = sk_alloc(net, PF_UNIX, GFP_KERNEL, &unix_proto, 1);
605 if (!sk) 606 if (!sk)
606 goto out; 607 goto out;
607 608
@@ -627,8 +628,11 @@ out:
627 return sk; 628 return sk;
628} 629}
629 630
630static int unix_create(struct socket *sock, int protocol) 631static int unix_create(struct net *net, struct socket *sock, int protocol)
631{ 632{
633 if (net != &init_net)
634 return -EAFNOSUPPORT;
635
632 if (protocol && protocol != PF_UNIX) 636 if (protocol && protocol != PF_UNIX)
633 return -EPROTONOSUPPORT; 637 return -EPROTONOSUPPORT;
634 638
@@ -654,7 +658,7 @@ static int unix_create(struct socket *sock, int protocol)
654 return -ESOCKTNOSUPPORT; 658 return -ESOCKTNOSUPPORT;
655 } 659 }
656 660
657 return unix_create1(sock) ? 0 : -ENOMEM; 661 return unix_create1(net, sock) ? 0 : -ENOMEM;
658} 662}
659 663
660static int unix_release(struct socket *sock) 664static int unix_release(struct socket *sock)
@@ -1038,7 +1042,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
1038 err = -ENOMEM; 1042 err = -ENOMEM;
1039 1043
1040 /* create new sock for complete connection */ 1044 /* create new sock for complete connection */
1041 newsk = unix_create1(NULL); 1045 newsk = unix_create1(sk->sk_net, NULL);
1042 if (newsk == NULL) 1046 if (newsk == NULL)
1043 goto out; 1047 goto out;
1044 1048
@@ -2082,25 +2086,7 @@ static const struct seq_operations unix_seq_ops = {
2082 2086
2083static int unix_seq_open(struct inode *inode, struct file *file) 2087static int unix_seq_open(struct inode *inode, struct file *file)
2084{ 2088{
2085 struct seq_file *seq; 2089 return seq_open_private(file, &unix_seq_ops, sizeof(int));
2086 int rc = -ENOMEM;
2087 int *iter = kmalloc(sizeof(int), GFP_KERNEL);
2088
2089 if (!iter)
2090 goto out;
2091
2092 rc = seq_open(file, &unix_seq_ops);
2093 if (rc)
2094 goto out_kfree;
2095
2096 seq = file->private_data;
2097 seq->private = iter;
2098 *iter = 0;
2099out:
2100 return rc;
2101out_kfree:
2102 kfree(iter);
2103 goto out;
2104} 2090}
2105 2091
2106static const struct file_operations unix_seq_fops = { 2092static const struct file_operations unix_seq_fops = {
@@ -2135,7 +2121,7 @@ static int __init af_unix_init(void)
2135 2121
2136 sock_register(&unix_family_ops); 2122 sock_register(&unix_family_ops);
2137#ifdef CONFIG_PROC_FS 2123#ifdef CONFIG_PROC_FS
2138 proc_net_fops_create("unix", 0, &unix_seq_fops); 2124 proc_net_fops_create(&init_net, "unix", 0, &unix_seq_fops);
2139#endif 2125#endif
2140 unix_sysctl_register(); 2126 unix_sysctl_register();
2141out: 2127out:
@@ -2146,7 +2132,7 @@ static void __exit af_unix_exit(void)
2146{ 2132{
2147 sock_unregister(PF_UNIX); 2133 sock_unregister(PF_UNIX);
2148 unix_sysctl_unregister(); 2134 unix_sysctl_unregister();
2149 proc_net_remove("unix"); 2135 proc_net_remove(&init_net, "unix");
2150 proto_unregister(&unix_proto); 2136 proto_unregister(&unix_proto);
2151} 2137}
2152 2138