From: Joe Perches <joe@perches.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Yuchung Cheng <ycheng@google.com>,
David Miller <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
Neal Cardwell <ncardwell@google.com>
Subject: Re: [PATCH v2 net-next] tcp: avoid possible arithmetic overflows
Date: Sun, 21 Sep 2014 20:56:55 -0700 [thread overview]
Message-ID: <1411358215.2952.26.camel@joe-AO725> (raw)
In-Reply-To: <1411259357.26859.89.camel@edumazet-glaptop2.roam.corp.google.com>
On Sat, 2014-09-20 at 17:29 -0700, Eric Dumazet wrote:
> 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
Thanks Eric.
> diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
[]
> @@ -3208,9 +3208,10 @@ static void tcp_ack_probe(struct sock *sk)
> * This function is not for random using!
> */
> } else {
> + unsigned long when = inet_csk_rto_backoff(icsk, TCP_RTO_MAX);
> +
> inet_csk_reset_xmit_timer(sk, ICSK_TIME_PROBE0,
> - min(icsk->icsk_rto << icsk->icsk_backoff, TCP_RTO_MAX),
> - TCP_RTO_MAX);
> + when, TCP_RTO_MAX);
Pity about the possible extra compare to TCP_RTO_MAX here.
I hope gcc smart enough to optimize it away.
next prev parent reply other threads:[~2014-09-22 3:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-20 17:19 [PATCH net-next] tcp: avoid possible arithmetic overflows Eric Dumazet
2014-09-20 18:01 ` Joe Perches
2014-09-20 19:46 ` Yuchung Cheng
2014-09-20 19:55 ` Eric Dumazet
2014-09-20 20:19 ` Joe Perches
2014-09-21 0:29 ` [PATCH v2 " Eric Dumazet
2014-09-21 17:46 ` Yuchung Cheng
2014-09-22 12:42 ` Eric Dumazet
2014-09-22 20:19 ` [PATCH v3 " Eric Dumazet
2014-09-22 20:27 ` David Miller
2014-09-22 20:28 ` Eric Dumazet
2014-09-22 3:56 ` Joe Perches [this message]
2014-09-22 11:13 ` [PATCH " David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1411358215.2952.26.camel@joe-AO725 \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=ycheng@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).