[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20200108.155803.2292394746055216594.davem@davemloft.net>
Date: Wed, 08 Jan 2020 15:58:03 -0800 (PST)
From: David Miller <davem@...emloft.net>
To: tuong.t.lien@...tech.com.au
Cc: jmaloy@...hat.com, maloy@...jonn.com, ying.xue@...driver.com,
netdev@...r.kernel.org, tipc-discussion@...ts.sourceforge.net
Subject: Re: [net] tipc: fix wrong connect() return code
From: Tuong Lien <tuong.t.lien@...tech.com.au>
Date: Wed, 8 Jan 2020 09:19:00 +0700
> The current 'tipc_wait_for_connect()' function does a wait-loop for the
> condition 'sk->sk_state != TIPC_CONNECTING' to conclude if the socket
> connecting has done. However, when the condition is met, it returns '0'
> even in the case the connecting is actually failed, the socket state is
> set to 'TIPC_DISCONNECTING' (e.g. when the server socket has closed..).
> This results in a wrong return code for the 'connect()' call from user,
> making it believe that the connection is established and go ahead with
> building, sending a message, etc. but finally failed e.g. '-EPIPE'.
>
> This commit fixes the issue by changing the wait condition to the
> 'tipc_sk_connected(sk)', so the function will return '0' only when the
> connection is really established. Otherwise, either the socket 'sk_err'
> if any or '-ETIMEDOUT'/'-EINTR' will be returned correspondingly.
>
> Acked-by: Ying Xue <ying.xue@...driver.com>
> Acked-by: Jon Maloy <jon.maloy@...csson.com>
> Signed-off-by: Tuong Lien <tuong.t.lien@...tech.com.au>
Applied.
Powered by blists - more mailing lists