* [PATCH] net: unix: allow bind to fail on mutex lock
@ 2013-12-13 15:54 Sasha Levin
2013-12-17 20:04 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2013-12-13 15:54 UTC (permalink / raw)
To: davem; +Cc: edumazet, netdev, xemul, linux-kernel, Sasha Levin
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>
---
net/unix/af_unix.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 7edbcd9..800ca61 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -720,7 +720,9 @@ static int unix_autobind(struct socket *sock)
int err;
unsigned int retries = 0;
- mutex_lock(&u->readlock);
+ err = mutex_lock_interruptible(&u->readlock);
+ if (err)
+ return err;
err = 0;
if (u->addr)
@@ -879,7 +881,9 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
goto out;
addr_len = err;
- mutex_lock(&u->readlock);
+ err = mutex_lock_interruptible(&u->readlock);
+ if (err)
+ goto out;
err = -EINVAL;
if (u->addr)
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: unix: allow bind to fail on mutex lock
2013-12-13 15:54 [PATCH] net: unix: allow bind to fail on mutex lock Sasha Levin
@ 2013-12-17 20:04 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-12-17 20:04 UTC (permalink / raw)
To: sasha.levin; +Cc: edumazet, netdev, xemul, linux-kernel
From: Sasha Levin <sasha.levin@oracle.com>
Date: Fri, 13 Dec 2013 10:54:22 -0500
> 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>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-17 20:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-13 15:54 [PATCH] net: unix: allow bind to fail on mutex lock Sasha Levin
2013-12-17 20:04 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).