lkml.org 
[lkml]   [2014]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.10 20/62] net: unix: allow bind to fail on mutex lock
    Date
    3.10-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Sasha Levin <sasha.levin@oracle.com>

    [ Upstream commit 37ab4fa7844a044dc21fde45e2a0fc2f3c3b6490 ]

    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>
    ---
    net/unix/af_unix.c | 8 ++++++--
    1 file changed, 6 insertions(+), 2 deletions(-)

    --- a/net/unix/af_unix.c
    +++ b/net/unix/af_unix.c
    @@ -717,7 +717,9 @@ static int unix_autobind(struct socket *
    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
    goto out;
    addr_len = err;

    - mutex_lock(&u->readlock);
    + err = mutex_lock_interruptible(&u->readlock);
    + if (err)
    + goto out;

    err = -EINVAL;
    if (u->addr)



    \
     
     \ /
      Last update: 2014-01-14 05:41    [W:5.177 / U:0.444 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site