From: Lawrence Brakmo <brakmo@fb.com>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>
Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tcp_nv: fix division by zero in tcpnv_acked()
Date: Wed, 1 Nov 2017 13:47:17 +0000 [thread overview]
Message-ID: <5FF5EDEE-FF34-43E0-9DFA-6CBDB206360D@fb.com> (raw)
In-Reply-To: <150954313588.153848.10192893966808917578.stgit@buzz>
Thank you for finding and fixing this.
On 11/1/17, 6:32 AM, "Konstantin Khlebnikov" <khlebnikov@yandex-team.ru> wrote:
Average RTT could become zero. This happened in real life at least twice.
This patch treats zero as 1us.
Signed-off-by: Konstantin Khlebnikov khlebnikov@yandex-team.ru
Acked-by: Lawrence Brakmo <Brakmo@fb.com>
---
net/ipv4/tcp_nv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/tcp_nv.c b/net/ipv4/tcp_nv.c
index 1ff73982e28c..125fc1450b01 100644
--- a/net/ipv4/tcp_nv.c
+++ b/net/ipv4/tcp_nv.c
@@ -252,7 +252,7 @@ static void tcpnv_acked(struct sock *sk, const struct ack_sample *sample)
/* rate in 100's bits per second */
rate64 = ((u64)sample->in_flight) * 8000000;
- rate = (u32)div64_u64(rate64, (u64)(avg_rtt * 100));
+ rate = (u32)div64_u64(rate64, (u64)(avg_rtt ?: 1) * 100);
/* Remember the maximum rate seen during this RTT
* Note: It may be more than one RTT. This function should be
next prev parent reply other threads:[~2017-11-01 13:47 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-01 13:32 Konstantin Khlebnikov
2017-11-01 13:47 ` Lawrence Brakmo [this message]
2017-11-01 14:13 ` Stephen Hemminger
2017-11-01 14:17 ` Eric Dumazet
2017-11-02 7:17 ` David Miller
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=5FF5EDEE-FF34-43E0-9DFA-6CBDB206360D@fb.com \
--to=brakmo@fb.com \
--cc=davem@davemloft.net \
--cc=khlebnikov@yandex-team.ru \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/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
all inboxes | Powered by JetHome®