From: Parthasarathy Bhuvaragan Date: Mon, 24 Apr 2017 13:00:42 +0000 (+0200) Subject: tipc: fix socket flow control accounting error at tipc_send_stream X-Git-Tag: v4.14-rc1~1087^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3364d61c92ecca7a8da990659c4b0ae1fcf0fcfb;p=platform%2Fkernel%2Flinux-rpi.git tipc: fix socket flow control accounting error at tipc_send_stream Until now in tipc_send_stream(), we return -1 when the socket encounters link congestion even if the socket had successfully sent partial data. This is incorrect as the application resends the same the partial data leading to data corruption at receiver's end. In this commit, we return the partially sent bytes as the return value at link congestion. Fixes: 10724cc7bb78 ("tipc: redesign connection-level flow control") Signed-off-by: Parthasarathy Bhuvaragan Reviewed-by: Jon Maloy Signed-off-by: David S. Miller --- diff --git a/net/tipc/socket.c b/net/tipc/socket.c index 7130e73..b28e94f 100644 --- a/net/tipc/socket.c +++ b/net/tipc/socket.c @@ -1083,7 +1083,7 @@ static int __tipc_sendstream(struct socket *sock, struct msghdr *m, size_t dlen) } } while (sent < dlen && !rc); - return rc ? rc : sent; + return sent ? sent : rc; } /**