Skip to content

Commit

Permalink
tcp: fix overflow in __tcp_retransmit_skb()
Browse files Browse the repository at this point in the history
[ Upstream commit ffb4d6c ]

If a TCP socket gets a large write queue, an overflow can happen
in a test in __tcp_retransmit_skb() preventing all retransmits.

The flow then stalls and resets after timeouts.

Tested:

sysctl -w net.core.wmem_max=1000000000
netperf -H dest -- -s 1000000000

Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
  • Loading branch information
Eric Dumazet authored and bwhacks committed Mar 16, 2017
1 parent 065d8e5 commit b2c5b70
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/ipv4/tcp_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -2097,7 +2097,8 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
* copying overhead: fragmentation, tunneling, mangling etc.
*/
if (atomic_read(&sk->sk_wmem_alloc) >
min(sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2), sk->sk_sndbuf))
min_t(u32, sk->sk_wmem_queued + (sk->sk_wmem_queued >> 2),
sk->sk_sndbuf))
return -EAGAIN;

if (before(TCP_SKB_CB(skb)->seq, tp->snd_una)) {
Expand Down

0 comments on commit b2c5b70

Please sign in to comment.