From: Parthasarathy Bhuvaragan Date: Tue, 25 Sep 2018 16:21:58 +0000 (+0200) Subject: tipc: fix flow control accounting for implicit connect X-Git-Tag: v4.14.77~86 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49984ca4e60ef5a707fd73b9e4bf34c539bbe2bf;p=platform%2Fkernel%2Flinux-exynos.git tipc: fix flow control accounting for implicit connect [ Upstream commit 92ef12b32feab8f277b69e9fb89ede2796777f4d ] In the case of implicit connect message with data > 1K, the flow control accounting is incorrect. At this state, the socket does not know the peer nodes capability and falls back to legacy flow control by return 1, however the receiver of this message will perform the new block accounting. This leads to a slack and eventually traffic disturbance. In this commit, we perform tipc_node_get_capabilities() at implicit connect and perform accounting based on the peer's capability. Signed-off-by: Parthasarathy Bhuvaragan Signed-off-by: Jon Maloy Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 0aebf0695ae0..4d2125d258fe 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1063,8 +1063,10 @@ static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dlen) /* Handle implicit connection setup */ if (unlikely(dest)) { rc = __tipc_sendmsg(sock, m, dlen); - if (dlen && (dlen == rc)) + if (dlen && dlen == rc) { + tsk->peer_caps = tipc_node_get_capabilities(net, dnode); tsk->snt_unacked = tsk_inc(tsk, dlen + msg_hdr_sz(hdr)); + } return rc; }