mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 09:41:54 +09:00
net: unix: allow bind to fail on mutex lock
[ Upstream commit 37ab4fa784 ]
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
36ffb57086
commit
57bc52eb25
@@ -717,7 +717,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)
|
||||
@@ -876,7 +878,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)
|
||||
|
||||
Reference in New Issue
Block a user