diff mbox series

[net] tipc: call tipc_wait_for_connect only when dlen is not 0

Message ID 7b0de7eba8cf97280106732f84800b55ff359604.1629011616.git.lucien.xin@gmail.com (mailing list archive)
State Accepted
Commit 7387a72c5f84f0dfb57618f9e4770672c0d2e4c9
Delegated to: Netdev Maintainers
Headers show
Series [net] tipc: call tipc_wait_for_connect only when dlen is not 0 | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers warning 1 maintainers not CCed: ying.xue@windriver.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes fail Link
netdev/checkpatch warning WARNING: Unknown commit id '36239dab6da7', maybe rebased or not pulled?
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Xin Long Aug. 15, 2021, 7:13 a.m. UTC
__tipc_sendmsg() is called to send SYN packet by either tipc_sendmsg()
or tipc_connect(). The difference is in tipc_connect(), it will call
tipc_wait_for_connect() after __tipc_sendmsg() to wait until connecting
is done. So there's no need to wait in __tipc_sendmsg() for this case.

This patch is to fix it by calling tipc_wait_for_connect() only when dlen
is not 0 in __tipc_sendmsg(), which means it's called by tipc_connect().

Note this also fixes the failure in tipcutils/test/ptts/:

  # ./tipcTS &
  # ./tipcTC 9
  (hang)

Fixes: 36239dab6da7 ("tipc: fix implicit-connect for SYN+")
Reported-by: Shuang Li <shuali@redhat.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: Jon Maloy <jmaloy@redhat.com>
---
 net/tipc/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Aug. 16, 2021, 10:30 a.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Sun, 15 Aug 2021 03:13:36 -0400 you wrote:
> __tipc_sendmsg() is called to send SYN packet by either tipc_sendmsg()
> or tipc_connect(). The difference is in tipc_connect(), it will call
> tipc_wait_for_connect() after __tipc_sendmsg() to wait until connecting
> is done. So there's no need to wait in __tipc_sendmsg() for this case.
> 
> This patch is to fix it by calling tipc_wait_for_connect() only when dlen
> is not 0 in __tipc_sendmsg(), which means it's called by tipc_connect().
> 
> [...]

Here is the summary with links:
  - [net] tipc: call tipc_wait_for_connect only when dlen is not 0
    https://git.kernel.org/netdev/net/c/7387a72c5f84

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 75b99b7eda22..8754bd885169 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -1518,7 +1518,7 @@  static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
 
 	if (unlikely(syn && !rc)) {
 		tipc_set_sk_state(sk, TIPC_CONNECTING);
-		if (timeout) {
+		if (dlen && timeout) {
 			timeout = msecs_to_jiffies(timeout);
 			tipc_wait_for_connect(sock, &timeout);
 		}