diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-18 21:02:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-18 21:02:35 -0400 |
commit | 334d094504c2fe1c44211ecb49146ae6bca8c321 (patch) | |
tree | d3c0f68e4b9f8e3d2ccc39e7dfe5de0534a5fad9 /net/unix/af_unix.c | |
parent | d1a4be630fb068f251d64b62919f143c49ca8057 (diff) | |
parent | d1643d24c61b725bef399cc1cf2944b4c9c23177 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6.26: (1090 commits)
[NET]: Fix and allocate less memory for ->priv'less netdevices
[IPV6]: Fix dangling references on error in fib6_add().
[NETLABEL]: Fix NULL deref in netlbl_unlabel_staticlist_gen() if ifindex not found
[PKT_SCHED]: Fix datalen check in tcf_simp_init().
[INET]: Uninline the __inet_inherit_port call.
[INET]: Drop the inet_inherit_port() call.
SCTP: Initialize partial_bytes_acked to 0, when all of the data is acked.
[netdrvr] forcedeth: internal simplifications; changelog removal
phylib: factor out get_phy_id from within get_phy_device
PHY: add BCM5464 support to broadcom PHY driver
cxgb3: Fix __must_check warning with dev_dbg.
tc35815: Statistics cleanup
natsemi: fix MMIO for PPC 44x platforms
[TIPC]: Cleanup of TIPC reference table code
[TIPC]: Optimized initialization of TIPC reference table
[TIPC]: Remove inlining of reference table locking routines
e1000: convert uint16_t style integers to u16
ixgb: convert uint16_t style integers to u16
sb1000.c: make const arrays static
sb1000.c: stop inlining largish static functions
...
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r-- | net/unix/af_unix.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index b8788fd5e3c..2851d0d1504 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) | |||
654 | static int unix_autobind(struct socket *sock) | 654 | static 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: | |||
758 | static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | 758 | static 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 | }; |
2019 | static struct sock *unix_seq_idx(struct unix_iter_state *iter, loff_t pos) | 2019 | static 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) | |||
2035 | static void *unix_seq_start(struct seq_file *seq, loff_t *pos) | 2036 | static 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 | ||
2043 | static void *unix_seq_next(struct seq_file *seq, void *v, loff_t *pos) | 2043 | static 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) | |||
2064 | static int unix_seq_show(struct seq_file *seq, void *v) | 2064 | static 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 | ||