aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2013-12-13 10:54:22 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-17 15:04:42 -0500
commit37ab4fa7844a044dc21fde45e2a0fc2f3c3b6490 (patch)
treedda88894bed9dcf9f6bc429c30f1816497b2b1cb /net
parentd1fc50247693bf9116184c19ca16386ff14f5aed (diff)
net: unix: allow bind to fail on mutex lock
This is similar to the set_peek_off patch where calling bind while the socket is stuck in unix_dgram_recvmsg() will block and cause a hung task spew after a while. This is also the last place that did a straightforward mutex_lock(), so there shouldn't be any more of these patches. Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/unix/af_unix.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index a0ca162e5bd5..a427623ee574 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -718,7 +718,9 @@ static int unix_autobind(struct socket *sock)
718 int err; 718 int err;
719 unsigned int retries = 0; 719 unsigned int retries = 0;
720 720
721 mutex_lock(&u->readlock); 721 err = mutex_lock_interruptible(&u->readlock);
722 if (err)
723 return err;
722 724
723 err = 0; 725 err = 0;
724 if (u->addr) 726 if (u->addr)
@@ -877,7 +879,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
877 goto out; 879 goto out;
878 addr_len = err; 880 addr_len = err;
879 881
880 mutex_lock(&u->readlock); 882 err = mutex_lock_interruptible(&u->readlock);
883 if (err)
884 goto out;
881 885
882 err = -EINVAL; 886 err = -EINVAL;
883 if (u->addr) 887 if (u->addr)