aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix
diff options
context:
space:
mode:
Diffstat (limited to 'net/unix')
-rw-r--r--net/unix/af_unix.c21
-rw-r--r--net/unix/garbage.c1
-rw-r--r--net/unix/sysctl_net_unix.c10
3 files changed, 16 insertions, 16 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index fc820cd75453..3d9122e78f41 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -144,7 +144,7 @@ static inline void unix_set_secdata(struct scm_cookie *scm, struct sk_buff *skb)
144/* 144/*
145 * SMP locking strategy: 145 * SMP locking strategy:
146 * hash table is protected with spinlock unix_table_lock 146 * hash table is protected with spinlock unix_table_lock
147 * each socket state is protected by separate rwlock. 147 * each socket state is protected by separate spin lock.
148 */ 148 */
149 149
150static inline unsigned unix_hash_fold(__wsum n) 150static inline unsigned unix_hash_fold(__wsum n)
@@ -621,7 +621,8 @@ out:
621 return sk; 621 return sk;
622} 622}
623 623
624static int unix_create(struct net *net, struct socket *sock, int protocol) 624static int unix_create(struct net *net, struct socket *sock, int protocol,
625 int kern)
625{ 626{
626 if (protocol && protocol != PF_UNIX) 627 if (protocol && protocol != PF_UNIX)
627 return -EPROTONOSUPPORT; 628 return -EPROTONOSUPPORT;
@@ -1032,8 +1033,8 @@ static int unix_stream_connect(struct socket *sock, struct sockaddr *uaddr,
1032 goto out; 1033 goto out;
1033 addr_len = err; 1034 addr_len = err;
1034 1035
1035 if (test_bit(SOCK_PASSCRED, &sock->flags) 1036 if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr &&
1036 && !u->addr && (err = unix_autobind(sock)) != 0) 1037 (err = unix_autobind(sock)) != 0)
1037 goto out; 1038 goto out;
1038 1039
1039 timeo = sock_sndtimeo(sk, flags & O_NONBLOCK); 1040 timeo = sock_sndtimeo(sk, flags & O_NONBLOCK);
@@ -1258,7 +1259,7 @@ static int unix_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_
1258{ 1259{
1259 struct sock *sk = sock->sk; 1260 struct sock *sk = sock->sk;
1260 struct unix_sock *u; 1261 struct unix_sock *u;
1261 struct sockaddr_un *sunaddr = (struct sockaddr_un *)uaddr; 1262 DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, uaddr);
1262 int err = 0; 1263 int err = 0;
1263 1264
1264 if (peer) { 1265 if (peer) {
@@ -1377,8 +1378,8 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1377 goto out; 1378 goto out;
1378 } 1379 }
1379 1380
1380 if (test_bit(SOCK_PASSCRED, &sock->flags) 1381 if (test_bit(SOCK_PASSCRED, &sock->flags) && !u->addr
1381 && !u->addr && (err = unix_autobind(sock)) != 0) 1382 && (err = unix_autobind(sock)) != 0)
1382 goto out; 1383 goto out;
1383 1384
1384 err = -EMSGSIZE; 1385 err = -EMSGSIZE;
@@ -2216,14 +2217,14 @@ static const struct file_operations unix_seq_fops = {
2216 2217
2217#endif 2218#endif
2218 2219
2219static struct net_proto_family unix_family_ops = { 2220static const struct net_proto_family unix_family_ops = {
2220 .family = PF_UNIX, 2221 .family = PF_UNIX,
2221 .create = unix_create, 2222 .create = unix_create,
2222 .owner = THIS_MODULE, 2223 .owner = THIS_MODULE,
2223}; 2224};
2224 2225
2225 2226
2226static int unix_net_init(struct net *net) 2227static int __net_init unix_net_init(struct net *net)
2227{ 2228{
2228 int error = -ENOMEM; 2229 int error = -ENOMEM;
2229 2230
@@ -2242,7 +2243,7 @@ out:
2242 return error; 2243 return error;
2243} 2244}
2244 2245
2245static void unix_net_exit(struct net *net) 2246static void __net_exit unix_net_exit(struct net *net)
2246{ 2247{
2247 unix_sysctl_unregister(net); 2248 unix_sysctl_unregister(net);
2248 proc_net_remove(net, "unix"); 2249 proc_net_remove(net, "unix");
diff --git a/net/unix/garbage.c b/net/unix/garbage.c
index 19c17e4a0c8b..14c22c3768da 100644
--- a/net/unix/garbage.c
+++ b/net/unix/garbage.c
@@ -74,7 +74,6 @@
74#include <linux/un.h> 74#include <linux/un.h>
75#include <linux/net.h> 75#include <linux/net.h>
76#include <linux/fs.h> 76#include <linux/fs.h>
77#include <linux/slab.h>
78#include <linux/skbuff.h> 77#include <linux/skbuff.h>
79#include <linux/netdevice.h> 78#include <linux/netdevice.h>
80#include <linux/file.h> 79#include <linux/file.h>
diff --git a/net/unix/sysctl_net_unix.c b/net/unix/sysctl_net_unix.c
index 83c093077ebc..397cffebb3b6 100644
--- a/net/unix/sysctl_net_unix.c
+++ b/net/unix/sysctl_net_unix.c
@@ -10,29 +10,29 @@
10 */ 10 */
11 11
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/slab.h>
13#include <linux/sysctl.h> 14#include <linux/sysctl.h>
14 15
15#include <net/af_unix.h> 16#include <net/af_unix.h>
16 17
17static ctl_table unix_table[] = { 18static ctl_table unix_table[] = {
18 { 19 {
19 .ctl_name = NET_UNIX_MAX_DGRAM_QLEN,
20 .procname = "max_dgram_qlen", 20 .procname = "max_dgram_qlen",
21 .data = &init_net.unx.sysctl_max_dgram_qlen, 21 .data = &init_net.unx.sysctl_max_dgram_qlen,
22 .maxlen = sizeof(int), 22 .maxlen = sizeof(int),
23 .mode = 0644, 23 .mode = 0644,
24 .proc_handler = proc_dointvec 24 .proc_handler = proc_dointvec
25 }, 25 },
26 { .ctl_name = 0 } 26 { }
27}; 27};
28 28
29static struct ctl_path unix_path[] = { 29static struct ctl_path unix_path[] = {
30 { .procname = "net", .ctl_name = CTL_NET, }, 30 { .procname = "net", },
31 { .procname = "unix", .ctl_name = NET_UNIX, }, 31 { .procname = "unix", },
32 { }, 32 { },
33}; 33};
34 34
35int unix_sysctl_register(struct net *net) 35int __net_init unix_sysctl_register(struct net *net)
36{ 36{
37 struct ctl_table *table; 37 struct ctl_table *table;
38 38