Skip to content

Commit

Permalink
tipc: fix socket flow control accounting error at tipc_recv_stream
Browse files Browse the repository at this point in the history
Until now in tipc_recv_stream(), we update the received
unacknowledged bytes based on a stack variable and not based on the
actual message size.
If the user buffer passed at tipc_recv_stream() is smaller than the
received skb, the size variable in stack differs from the actual
message size in the skb. This leads to a flow control accounting
error causing permanent congestion.

In this commit, we fix this accounting error by always using the
size of the incoming message.

Fixes: 10724cc ("tipc: redesign connection-level flow control")
Signed-off-by: Parthasarathy Bhuvaragan <[email protected]>
Reviewed-by: Jon Maloy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Parthasarathy Bhuvaragan authored and davem330 committed Apr 25, 2017
1 parent 3364d61 commit 05ff837
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/tipc/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,7 @@ static int tipc_recv_stream(struct socket *sock, struct msghdr *m,
if (unlikely(flags & MSG_PEEK))
goto exit;

tsk->rcv_unacked += tsk_inc(tsk, hlen + sz);
tsk->rcv_unacked += tsk_inc(tsk, hlen + msg_data_sz(msg));
if (unlikely(tsk->rcv_unacked >= (tsk->rcv_win / 4)))
tipc_sk_send_ack(tsk);
tsk_advance_rx_queue(sk);
Expand Down

0 comments on commit 05ff837

Please sign in to comment.