[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091019115713.GB6869@ff.dom.local>
Date: Mon, 19 Oct 2009 11:57:13 +0000
From: Jarek Poplawski <jarkao2@...il.com>
To: Tomoki Sekiyama <tomoki.sekiyama.qu@...achi.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
alan@...rguk.ukuu.org.uk, davem@...emloft.net,
satoshi.oshima.fk@...achi.com, hidehiro.kawai.ez@...achi.com,
hideo.aoki.tk@...achi.com
Subject: Re: [PATCH] AF_UNIX: Fix deadlock on connecting to shutdown socket
On 19-10-2009 08:02, Tomoki Sekiyama wrote:
...
> Why this happens:
> Error checks between unix_socket_connect() and unix_wait_for_peer() are
> inconsistent. The former calls the latter to wait until the backlog is
> processed. Despite the latter returns without doing anything when the
> socket is shutdown, the former doesn't check the shutdown state and
> just retries calling the latter forever.
>
> Patch:
> The patch below adds shutdown check into unix_socket_connect(), so
> connect(2) to the shutdown socket will return -ECONREFUSED.
>
> Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama.qu@...achi.com>
> Signed-off-by: Masanori Yoshida <masanori.yoshida.tv@...achi.com>
> ---
> net/unix/af_unix.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 51ab497..fc820cd 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -1074,6 +1074,8 @@ restart:
> err = -ECONNREFUSED;
> if (other->sk_state != TCP_LISTEN)
> goto out_unlock;
> + if (other->sk_shutdown & RCV_SHUTDOWN)
> + goto out_unlock;
Isn't the shutdown call expected to change sk_state to TCP_CLOSE?
Jarek P.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists