aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/af_unix.c13
-rw-r--r--net/unix/diag.c7
-rw-r--r--net/unix/garbage.c2
3 files changed, 8 insertions, 14 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 5b5c876c80e9..51be64f163ec 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -263,9 +263,8 @@ static struct sock *__unix_find_socket_byname(struct net *net,
263 int len, int type, unsigned int hash) 263 int len, int type, unsigned int hash)
264{ 264{
265 struct sock *s; 265 struct sock *s;
266 struct hlist_node *node;
267 266
268 sk_for_each(s, node, &unix_socket_table[hash ^ type]) { 267 sk_for_each(s, &unix_socket_table[hash ^ type]) {
269 struct unix_sock *u = unix_sk(s); 268 struct unix_sock *u = unix_sk(s);
270 269
271 if (!net_eq(sock_net(s), net)) 270 if (!net_eq(sock_net(s), net))
@@ -298,10 +297,9 @@ static inline struct sock *unix_find_socket_byname(struct net *net,
298static struct sock *unix_find_socket_byinode(struct inode *i) 297static struct sock *unix_find_socket_byinode(struct inode *i)
299{ 298{
300 struct sock *s; 299 struct sock *s;
301 struct hlist_node *node;
302 300
303 spin_lock(&unix_table_lock); 301 spin_lock(&unix_table_lock);
304 sk_for_each(s, node, 302 sk_for_each(s,
305 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) { 303 &unix_socket_table[i->i_ino & (UNIX_HASH_SIZE - 1)]) {
306 struct dentry *dentry = unix_sk(s)->path.dentry; 304 struct dentry *dentry = unix_sk(s)->path.dentry;
307 305
@@ -2402,7 +2400,7 @@ static int __net_init unix_net_init(struct net *net)
2402 goto out; 2400 goto out;
2403 2401
2404#ifdef CONFIG_PROC_FS 2402#ifdef CONFIG_PROC_FS
2405 if (!proc_net_fops_create(net, "unix", 0, &unix_seq_fops)) { 2403 if (!proc_create("unix", 0, net->proc_net, &unix_seq_fops)) {
2406 unix_sysctl_unregister(net); 2404 unix_sysctl_unregister(net);
2407 goto out; 2405 goto out;
2408 } 2406 }
@@ -2415,7 +2413,7 @@ out:
2415static void __net_exit unix_net_exit(struct net *net) 2413static void __net_exit unix_net_exit(struct net *net)
2416{ 2414{
2417 unix_sysctl_unregister(net); 2415 unix_sysctl_unregister(net);
2418 proc_net_remove(net, "unix"); 2416 remove_proc_entry("unix", net->proc_net);
2419} 2417}
2420 2418
2421static struct pernet_operations unix_net_ops = { 2419static struct pernet_operations unix_net_ops = {
@@ -2426,9 +2424,8 @@ static struct pernet_operations unix_net_ops = {
2426static int __init af_unix_init(void) 2424static int __init af_unix_init(void)
2427{ 2425{
2428 int rc = -1; 2426 int rc = -1;
2429 struct sk_buff *dummy_skb;
2430 2427
2431 BUILD_BUG_ON(sizeof(struct unix_skb_parms) > sizeof(dummy_skb->cb)); 2428 BUILD_BUG_ON(sizeof(struct unix_skb_parms) > FIELD_SIZEOF(struct sk_buff, cb));
2432 2429
2433 rc = proto_register(&unix_proto, 1); 2430 rc = proto_register(&unix_proto, 1);
2434 if (rc != 0) { 2431 if (rc != 0) {
diff --git a/net/unix/diag.c b/net/unix/diag.c
index 5ac19dc1d5e4..d591091603bf 100644
--- a/net/unix/diag.c
+++ b/net/unix/diag.c
@@ -192,10 +192,9 @@ static int unix_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
192 slot < ARRAY_SIZE(unix_socket_table); 192 slot < ARRAY_SIZE(unix_socket_table);
193 s_num = 0, slot++) { 193 s_num = 0, slot++) {
194 struct sock *sk; 194 struct sock *sk;
195 struct hlist_node *node;
196 195
197 num = 0; 196 num = 0;
198 sk_for_each(sk, node, &unix_socket_table[slot]) { 197 sk_for_each(sk, &unix_socket_table[slot]) {
199 if (!net_eq(sock_net(sk), net)) 198 if (!net_eq(sock_net(sk), net))
200 continue; 199 continue;
201 if (num < s_num) 200 if (num < s_num)
@@ -226,9 +225,7 @@ static struct sock *unix_lookup_by_ino(int ino)
226 225
227 spin_lock(&unix_table_lock); 226 spin_lock(&unix_table_lock);
228 for (i = 0; i < ARRAY_SIZE(unix_socket_table); i++) { 227 for (i = 0; i < ARRAY_SIZE(unix_socket_table); i++) {
229 struct hlist_node *node; 228 sk_for_each(sk, &unix_socket_table[i])
230
231 sk_for_each(sk, node, &unix_socket_table[i])
232 if (ino == sock_i_ino(sk)) { 229 if (ino == sock_i_ino(sk)) {
233 sock_hold(sk); 230 sock_hold(sk);
234 spin_unlock(&unix_table_lock); 231 spin_unlock(&unix_table_lock);
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index b6f4b994eb35..d0f6545b0010 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -99,7 +99,7 @@ unsigned int unix_tot_inflight;
99struct sock *unix_get_socket(struct file *filp) 99struct sock *unix_get_socket(struct file *filp)
100{ 100{
101 struct sock *u_sock = NULL; 101 struct sock *u_sock = NULL;
102 struct inode *inode = filp->f_path.dentry->d_inode; 102 struct inode *inode = file_inode(filp);
103 103
104 /* 104 /*
105 * Socket ? 105 * Socket ?