Commit c0be5de1 authored by Sasha Levin's avatar Sasha Levin Committed by Greg Kroah-Hartman

net: unix: allow bind to fail on mutex lock

[ Upstream commit 37ab4fa7 ]

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: default avatarSasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0248d4b4
......@@ -712,7 +712,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)
......@@ -845,7 +847,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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment