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 <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
35f7aa5309
commit
fcdd1cf4dd
@@ -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);
|
||||
|
Reference in New Issue
Block a user