aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-04-19 12:17:34 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-19 12:17:34 -0400
commitcf816ecb533ab96b883dfdc0db174598b5b5c4d2 (patch)
tree1b7705db288ae2917105e624b01fdf81e0882bf1 /net/unix/af_unix.c
parentadf6d34e460387ee3e8f1e1875d52bff51212c7d (diff)
parent15f7d677ccff6f0f5de8a1ee43a792567e9f9de9 (diff)
Merge branch 'merge-fixes' into devel
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index b8788fd5e3c6..2851d0d15048 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -252,7 +252,7 @@ static struct sock *__unix_find_socket_byname(struct net *net,
252 sk_for_each(s, node, &unix_socket_table[hash ^ type]) { 252 sk_for_each(s, node, &unix_socket_table[hash ^ type]) {
253 struct unix_sock *u = unix_sk(s); 253 struct unix_sock *u = unix_sk(s);
254 254
255 if (s->sk_net != net) 255 if (!net_eq(sock_net(s), net))
256 continue; 256 continue;
257 257
258 if (u->addr->len == len && 258 if (u->addr->len == len &&
@@ -289,7 +289,7 @@ static struct sock *unix_find_socket_byinode(struct net *net, struct inode *i)
289 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { 289 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) {
290 struct dentry *dentry = unix_sk(s)->dentry; 290 struct dentry *dentry = unix_sk(s)->dentry;
291 291
292 if (s->sk_net != net) 292 if (!net_eq(sock_net(s), net))
293 continue; 293 continue;
294 294
295 if(dentry && dentry->d_inode == i) 295 if(dentry && dentry->d_inode == i)
@@ -654,7 +654,7 @@ static int unix_release(struct socket *sock)
654static int unix_autobind(struct socket *sock) 654static int unix_autobind(struct socket *sock)
655{ 655{
656 struct sock *sk = sock->sk; 656 struct sock *sk = sock->sk;
657 struct net *net = sk->sk_net; 657 struct net *net = sock_net(sk);
658 struct unix_sock *u = unix_sk(sk); 658 struct unix_sock *u = unix_sk(sk);
659 static u32 ordernum = 1; 659 static u32 ordernum = 1;
660 struct unix_address * addr; 660 struct unix_address * addr;
@@ -758,7 +758,7 @@ fail:
758static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) 758static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
759{ 759{
760 struct sock *sk = sock->sk; 760 struct sock *sk = sock->sk;
761 struct net *net = sk->sk_net; 761 struct net *net = sock_net(sk);
762 struct unix_sock *u = unix_sk(sk); 762 struct unix_sock *u = unix_sk(sk);
763 struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; 763 struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
764 struct dentry * dentry = NULL; 764 struct dentry * dentry = NULL;
@@ -899,7 +899,7 @@ static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr,
899 int alen, int flags) 899 int alen, int flags)
900{ 900{
901 struct sock *sk = sock->sk; 901 struct sock *sk = sock->sk;
902 struct net *net = sk->sk_net; 902 struct net *net = sock_net(sk);
903 struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr; 903 struct sockaddr_un *sunaddr=(struct sockaddr_un*)addr;
904 struct sock *other; 904 struct sock *other;
905 unsigned hash; 905 unsigned hash;
@@ -996,7 +996,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
996{ 996{
997 struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr; 997 struct sockaddr_un *sunaddr=(struct sockaddr_un *)uaddr;
998 struct sock *sk = sock->sk; 998 struct sock *sk = sock->sk;
999 struct net *net = sk->sk_net; 999 struct net *net = sock_net(sk);
1000 struct unix_sock *u = unix_sk(sk), *newu, *otheru; 1000 struct unix_sock *u = unix_sk(sk), *newu, *otheru;
1001 struct sock *newsk = NULL; 1001 struct sock *newsk = NULL;
1002 struct sock *other = NULL; 1002 struct sock *other = NULL;
@@ -1025,7 +1025,7 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
1025 err = -ENOMEM; 1025 err = -ENOMEM;
1026 1026
1027 /* create new sock for complete connection */ 1027 /* create new sock for complete connection */
1028 newsk = unix_create1(sk->sk_net, NULL); 1028 newsk = unix_create1(sock_net(sk), NULL);
1029 if (newsk == NULL) 1029 if (newsk == NULL)
1030 goto out; 1030 goto out;
1031 1031
@@ -1312,7 +1312,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1312{ 1312{
1313 struct sock_iocb *siocb = kiocb_to_siocb(kiocb); 1313 struct sock_iocb *siocb = kiocb_to_siocb(kiocb);
1314 struct sock *sk = sock->sk; 1314 struct sock *sk = sock->sk;
1315 struct net *net = sk->sk_net; 1315 struct net *net = sock_net(sk);
1316 struct unix_sock *u = unix_sk(sk); 1316 struct unix_sock *u = unix_sk(sk);
1317 struct sockaddr_un *sunaddr=msg->msg_name; 1317 struct sockaddr_un *sunaddr=msg->msg_name;
1318 struct sock *other = NULL; 1318 struct sock *other = NULL;
@@ -2016,13 +2016,14 @@ struct unix_iter_state {
2016 struct seq_net_private p; 2016 struct seq_net_private p;
2017 int i; 2017 int i;
2018}; 2018};
2019static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos) 2019static struct sock *unix_seq_idx(struct seq_file *seq, loff_t pos)
2020{ 2020{
2021 struct unix_iter_state *iter = seq->private;
2021 loff_t off = 0; 2022 loff_t off = 0;
2022 struct sock *s; 2023 struct sock *s;
2023 2024
2024 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) { 2025 for (s = first_unix_socket(&iter->i); s; s = next_unix_socket(&iter->i, s)) {
2025 if (s->sk_net != iter->p.net) 2026 if (sock_net(s) != seq_file_net(seq))
2026 continue; 2027 continue;
2027 if (off == pos) 2028 if (off == pos)
2028 return s; 2029 return s;
@@ -2035,9 +2036,8 @@ static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos)
2035static void *unix_seq_start(struct seq_file *seq, loff_t *pos) 2036static void *unix_seq_start(struct seq_file *seq, loff_t *pos)
2036 __acquires(unix_table_lock) 2037 __acquires(unix_table_lock)
2037{ 2038{
2038 struct unix_iter_state *iter = seq->private;
2039 spin_lock(&unix_table_lock); 2039 spin_lock(&unix_table_lock);
2040 return *pos ? unix_seq_idx(iter, *pos - 1) : ((void *) 1); 2040 return *pos ? unix_seq_idx(seq, *pos - 1) : SEQ_START_TOKEN;
2041} 2041}
2042 2042
2043static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos) 2043static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos)
@@ -2046,11 +2046,11 @@ static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos)
2046 struct sock *sk = v; 2046 struct sock *sk = v;
2047 ++*pos; 2047 ++*pos;
2048 2048
2049 if (v == (void *)1) 2049 if (v == SEQ_START_TOKEN)
2050 sk = first_unix_socket(&iter->i); 2050 sk = first_unix_socket(&iter->i);
2051 else 2051 else
2052 sk = next_unix_socket(&iter->i, sk); 2052 sk = next_unix_socket(&iter->i, sk);
2053 while (sk && (sk->sk_net != iter->p.net)) 2053 while (sk && (sock_net(sk) != seq_file_net(seq)))
2054 sk = next_unix_socket(&iter->i, sk); 2054 sk = next_unix_socket(&iter->i, sk);
2055 return sk; 2055 return sk;
2056} 2056}
@@ -2064,7 +2064,7 @@ static void unix_seq_stop(struct seq_file *seq, void *v)
2064static int unix_seq_show(struct seq_file *seq, void *v) 2064static int unix_seq_show(struct seq_file *seq, void *v)
2065{ 2065{
2066 2066
2067 if (v == (void *)1) 2067 if (v == SEQ_START_TOKEN)
2068 seq_puts(seq, "Num RefCount Protocol Flags Type St " 2068 seq_puts(seq, "Num RefCount Protocol Flags Type St "
2069 "Inode Path\n"); 2069 "Inode Path\n");
2070 else { 2070 else {
@@ -2176,7 +2176,7 @@ static int __init af_unix_init(void)
2176 rc = proto_register(&unix_proto, 1); 2176 rc = proto_register(&unix_proto, 1);
2177 if (rc != 0) { 2177 if (rc != 0) {
2178 printk(KERN_CRIT "%s: Cannot create unix_sock SLAB cache!\n", 2178 printk(KERN_CRIT "%s: Cannot create unix_sock SLAB cache!\n",
2179 __FUNCTION__); 2179 __func__);
2180 goto out; 2180 goto out;
2181 } 2181 }
2182 2182