diff options
| author | Eric Dumazet <[email protected]> | 2014-09-22 20:19:44 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2014-09-22 20:27:10 +0000 |
| commit | fcdd1cf4dd63aecf86c987d7f4ec7187be5c2fbc (patch) | |
| tree | 9f74f24f8fe931ffac65805a30bf7e53de7e89b1 /net/ipv4/tcp_ipv4.c | |
| parent | ipv6: mld: answer mldv2 queries with mldv1 reports in mldv1 fallback (diff) | |
| download | kernel-fcdd1cf4dd63aecf86c987d7f4ec7187be5c2fbc.tar.gz kernel-fcdd1cf4dd63aecf86c987d7f4ec7187be5c2fbc.zip | |
tcp: avoid possible arithmetic overflows
icsk_rto is a 32bit field, and icsk_backoff can reach 15 by default,
or more if some sysctl (eg tcp_retries2) are changed.
Better use 64bit to perform icsk_rto << icsk_backoff operations
As Joe Perches suggested, add a helper for this.
Yuchung spotted the tcp_v4_err() case.
Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/ipv4/tcp_ipv4.c')
| -rw-r--r-- | net/ipv4/tcp_ipv4.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c index 006b045716d8..3b2e49cb2b61 100644 --- a/net/ipv4/tcp_ipv4.c +++ b/net/ipv4/tcp_ipv4.c @@ -430,9 +430,9 @@ void tcp_v4_err(struct sk_buff *icmp_skb, u32 info) break; icsk->icsk_backoff--; - inet_csk(sk)->icsk_rto = (tp->srtt_us ? __tcp_set_rto(tp) : - TCP_TIMEOUT_INIT) << icsk->icsk_backoff; - tcp_bound_rto(sk); + icsk->icsk_rto = tp->srtt_us ? __tcp_set_rto(tp) : + TCP_TIMEOUT_INIT; + icsk->icsk_rto = inet_csk_rto_backoff(icsk, TCP_RTO_MAX); skb = tcp_write_queue_head(sk); BUG_ON(!skb); |
