aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-02-20 08:54:28 -0500
committerJiri Kosina <jkosina@suse.cz>2014-02-20 08:54:28 -0500
commitd4263348f796f29546f90802177865dd4379dd0a (patch)
treeadcbdaebae584eee2f32fab95e826e8e49eef385 /net/unix/af_unix.c
parentbe873ac782f5ff5ee6675f83929f4fe6737eead2 (diff)
parent6d0abeca3242a88cab8232e4acd7e2bf088f3bc2 (diff)
Merge branch 'master' into for-next
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a0ca162e5bd5..29fc8bee9702 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -80,6 +80,8 @@
80 * with BSD names. 80 * with BSD names.
81 */ 81 */
82 82
83#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
84
83#include <linux/module.h> 85#include <linux/module.h>
84#include <linux/kernel.h> 86#include <linux/kernel.h>
85#include <linux/signal.h> 87#include <linux/signal.h>
@@ -366,7 +368,7 @@ static void unix_sock_destructor(struct sock *sk)
366 WARN_ON(!sk_unhashed(sk)); 368 WARN_ON(!sk_unhashed(sk));
367 WARN_ON(sk->sk_socket); 369 WARN_ON(sk->sk_socket);
368 if (!sock_flag(sk, SOCK_DEAD)) { 370 if (!sock_flag(sk, SOCK_DEAD)) {
369 printk(KERN_INFO "Attempt to release alive unix socket: %p\n", sk); 371 pr_info("Attempt to release alive unix socket: %p\n", sk);
370 return; 372 return;
371 } 373 }
372 374
@@ -378,7 +380,7 @@ static void unix_sock_destructor(struct sock *sk)
378 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1); 380 sock_prot_inuse_add(sock_net(sk), sk->sk_prot, -1);
379 local_bh_enable(); 381 local_bh_enable();
380#ifdef UNIX_REFCNT_DEBUG 382#ifdef UNIX_REFCNT_DEBUG
381 printk(KERN_DEBUG "UNIX %p is destroyed, %ld are still alive.\n", sk, 383 pr_debug("UNIX %p is destroyed, %ld are still alive.\n", sk,
382 atomic_long_read(&unix_nr_socks)); 384 atomic_long_read(&unix_nr_socks));
383#endif 385#endif
384} 386}
@@ -718,7 +720,9 @@ static int unix_autobind(struct socket *sock)
718 int err; 720 int err;
719 unsigned int retries = 0; 721 unsigned int retries = 0;
720 722
721 mutex_lock(&u->readlock); 723 err = mutex_lock_interruptible(&u->readlock);
724 if (err)
725 return err;
722 726
723 err = 0; 727 err = 0;
724 if (u->addr) 728 if (u->addr)
@@ -877,7 +881,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
877 goto out; 881 goto out;
878 addr_len = err; 882 addr_len = err;
879 883
880 mutex_lock(&u->readlock); 884 err = mutex_lock_interruptible(&u->readlock);
885 if (err)
886 goto out;
881 887
882 err = -EINVAL; 888 err = -EINVAL;
883 if (u->addr) 889 if (u->addr)
@@ -1444,7 +1450,7 @@ static int unix_dgram_sendmsg(struct kiocb *kiocb, struct socket *sock,
1444 struct sock *sk = sock->sk; 1450 struct sock *sk = sock->sk;
1445 struct net *net = sock_net(sk); 1451 struct net *net = sock_net(sk);
1446 struct unix_sock *u = unix_sk(sk); 1452 struct unix_sock *u = unix_sk(sk);
1447 struct sockaddr_un *sunaddr = msg->msg_name; 1453 DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, msg->msg_name);
1448 struct sock *other = NULL; 1454 struct sock *other = NULL;
1449 int namelen = 0; /* fake GCC */ 1455 int namelen = 0; /* fake GCC */
1450 int err; 1456 int err;
@@ -1906,7 +1912,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
1906 struct scm_cookie tmp_scm; 1912 struct scm_cookie tmp_scm;
1907 struct sock *sk = sock->sk; 1913 struct sock *sk = sock->sk;
1908 struct unix_sock *u = unix_sk(sk); 1914 struct unix_sock *u = unix_sk(sk);
1909 struct sockaddr_un *sunaddr = msg->msg_name; 1915 DECLARE_SOCKADDR(struct sockaddr_un *, sunaddr, msg->msg_name);
1910 int copied = 0; 1916 int copied = 0;
1911 int check_creds = 0; 1917 int check_creds = 0;
1912 int target; 1918 int target;
@@ -2437,8 +2443,7 @@ static int __init af_unix_init(void)
2437 2443
2438 rc = proto_register(&unix_proto, 1); 2444 rc = proto_register(&unix_proto, 1);
2439 if (rc != 0) { 2445 if (rc != 0) {
2440 printk(KERN_CRIT "%s: Cannot create unix_sock SLAB cache!\n", 2446 pr_crit("%s: Cannot create unix_sock SLAB cache!\n", __func__);
2441 __func__);
2442 goto out; 2447 goto out;
2443 } 2448 }
2444 2449