Skip to content

Commit 0a178a0

Browse files
lxingregkh
authored andcommitted
tipc: call tipc_wait_for_connect only when dlen is not 0
commit 7387a72 upstream. __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> Signed-off-by: David S. Miller <davem@davemloft.net> Cc: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ded6da2 commit 0a178a0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

net/tipc/socket.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1511,7 +1511,7 @@ static int __tipc_sendmsg(struct socket *sock, struct msghdr *m, size_t dlen)
15111511

15121512
if (unlikely(syn && !rc)) {
15131513
tipc_set_sk_state(sk, TIPC_CONNECTING);
1514-
if (timeout) {
1514+
if (dlen && timeout) {
15151515
timeout = msecs_to_jiffies(timeout);
15161516
tipc_wait_for_connect(sock, &timeout);
15171517
}

0 commit comments

Comments
 (0)