Skip to content

Commit

Permalink
net: unix: allow bind to fail on mutex lock
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sasha Levin authored and David S. Miller committed Dec 17, 2013
1 parent d1fc502 commit 37ab4fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/unix/af_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,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)
Expand Down Expand Up @@ -877,7 +879,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)
Expand Down

0 comments on commit 37ab4fa

Please sign in to comment.