linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Neal Cardwell <ncardwell@google.com>,
	Yuchung Cheng <ycheng@google.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"David S. Miller" <davem@davemloft.net>
Subject: [ 09/46] tcp: cubic: fix overflow error in bictcp_update()
Date: Thu, 12 Sep 2013 10:58:20 -0700	[thread overview]
Message-ID: <20130912175722.075408798@linuxfoundation.org> (raw)
In-Reply-To: <20130912175721.001906199@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 2ed0edf9090bf4afa2c6fc4f38575a85a80d4b20 ]

commit 17a6e9f1aa9 ("tcp_cubic: fix clock dependency") added an
overflow error in bictcp_update() in following code :

/* change the unit from HZ to bictcp_HZ */
t = ((tcp_time_stamp + msecs_to_jiffies(ca->delay_min>>3) -
      ca->epoch_start) << BICTCP_HZ) / HZ;

Because msecs_to_jiffies() being unsigned long, compiler does
implicit type promotion.

We really want to constrain (tcp_time_stamp - ca->epoch_start)
to a signed 32bit value, or else 't' has unexpected high values.

This bugs triggers an increase of retransmit rates ~24 days after
boot [1], as the high order bit of tcp_time_stamp flips.

[1] for hosts with HZ=1000

Big thanks to Van Jacobson for spotting this problem.

Diagnosed-by: Van Jacobson <vanj@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Neal Cardwell <ncardwell@google.com>
Cc: Yuchung Cheng <ycheng@google.com>
Cc: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 net/ipv4/tcp_cubic.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -206,8 +206,8 @@ static u32 cubic_root(u64 a)
  */
 static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
 {
-	u64 offs;
-	u32 delta, t, bic_target, max_cnt;
+	u32 delta, bic_target, max_cnt;
+	u64 offs, t;
 
 	ca->ack_cnt++;	/* count the number of ACKs */
 
@@ -250,9 +250,11 @@ static inline void bictcp_update(struct
 	 * if the cwnd < 1 million packets !!!
 	 */
 
+	t = (s32)(tcp_time_stamp - ca->epoch_start);
+	t += msecs_to_jiffies(ca->delay_min >> 3);
 	/* change the unit from HZ to bictcp_HZ */
-	t = ((tcp_time_stamp + msecs_to_jiffies(ca->delay_min>>3)
-	      - ca->epoch_start) << BICTCP_HZ) / HZ;
+	t <<= BICTCP_HZ;
+	do_div(t, HZ);
 
 	if (t < ca->bic_K)		/* t - K */
 		offs = ca->bic_K - t;



  parent reply	other threads:[~2013-09-12 17:59 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-12 17:58 [ 00/46] 3.10.12-stable review Greg Kroah-Hartman
2013-09-12 17:58 ` [ 01/46] htb: fix sign extension bug Greg Kroah-Hartman
2013-09-12 17:58 ` [ 02/46] net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails Greg Kroah-Hartman
2013-09-12 17:58 ` [ 03/46] net: check net.core.somaxconn sysctl values Greg Kroah-Hartman
2013-09-12 17:58 ` [ 04/46] macvlan: validate flags Greg Kroah-Hartman
2013-09-12 17:58 ` [ 05/46] neighbour: populate neigh_parms on alloc before calling ndo_neigh_setup Greg Kroah-Hartman
2013-09-12 17:58 ` [ 06/46] bonding: modify only neigh_parms owned by us Greg Kroah-Hartman
2013-09-12 17:58 ` [ 07/46] fib_trie: remove potential out of bound access Greg Kroah-Hartman
2013-09-12 17:58 ` [ 08/46] bridge: dont try to update timers in case of broken MLD queries Greg Kroah-Hartman
2013-09-12 17:58 ` Greg Kroah-Hartman [this message]
2013-09-12 17:58 ` [ 10/46] tcp: cubic: fix bug in bictcp_acked() Greg Kroah-Hartman
2013-09-12 17:58 ` [ 11/46] ipv6: dont stop backtracking in fib6_lookup_1 if subtree does not match Greg Kroah-Hartman
2013-09-12 17:58 ` [ 12/46] ip_gre: fix ipgre_header to return correct offset MIME-Version: 1.0 Greg Kroah-Hartman
2013-09-12 17:58 ` [ 13/46] 8139cp: Fix skb leak in rx_status_loop failure path Greg Kroah-Hartman
2013-09-12 17:58 ` [ 14/46] rtnetlink: Fix inverted check in ndo_dflt_fdb_del() Greg Kroah-Hartman
2013-09-12 17:58 ` [ 15/46] genl: Fix genl dumpit() locking Greg Kroah-Hartman
2013-09-12 17:58 ` [ 16/46] genl: Hold reference on correct module while netlink-dump Greg Kroah-Hartman
2013-09-12 17:58 ` [ 17/46] ip_tunnel: Do not use inner ip-header-id for tunnel ip-header-id Greg Kroah-Hartman
2013-09-12 17:58 ` [ 18/46] rtnetlink: rtnl_bridge_getlink: Call nlmsg_find_attr() with ifinfomsg header Greg Kroah-Hartman
2013-09-12 17:58 ` [ 19/46] tun: signedness bug in tun_get_user() Greg Kroah-Hartman
2013-09-12 17:58 ` [ 20/46] ipv6: remove max_addresses check from ipv6_create_tempaddr Greg Kroah-Hartman
2013-09-12 17:58 ` [ 21/46] ipv6: drop packets with multiple fragmentation headers Greg Kroah-Hartman
2013-09-12 17:58 ` [ 22/46] tcp: set timestamps for restored skb-s Greg Kroah-Hartman
2013-09-12 17:58 ` [ 23/46] packet: restore packet statistics tp_packets to include drops Greg Kroah-Hartman
2013-09-12 17:58 ` [ 24/46] bridge: Use the correct bit length for bitmap functions in the VLAN code Greg Kroah-Hartman
2013-09-12 17:58 ` [ 25/46] net_sched: restore "linklayer atm" handling Greg Kroah-Hartman
2013-09-12 17:58 ` [ 26/46] sfc: Fix lookup of default RX MAC filters when steered using ethtool Greg Kroah-Hartman
2013-09-12 17:58 ` [ 27/46] be2net: fix disabling TX in be_close() Greg Kroah-Hartman
2013-09-12 17:58 ` [ 28/46] net: usb: Add HP hs2434 device to ZLP exception table Greg Kroah-Hartman
2013-09-12 17:58 ` [ 29/46] tcp: initialize rcv_tstamp for restored sockets Greg Kroah-Hartman
2013-09-12 17:58 ` [ 30/46] tcp: dont apply tsoffset if rcv_tsecr is zero Greg Kroah-Hartman
2013-09-12 17:58 ` [ 31/46] ipv4: sendto/hdrincl: dont use destination address found in header Greg Kroah-Hartman
2013-09-12 17:58 ` [ 32/46] ipv6: Dont depend on per socket memory for neighbour discovery messages Greg Kroah-Hartman
2013-09-12 17:58 ` [ 33/46] tcp: tcp_make_synack() should use sock_wmalloc Greg Kroah-Hartman
2013-09-12 17:58 ` [ 34/46] tipc: set sk_err correctly when connection fails Greg Kroah-Hartman
2013-09-12 17:58 ` [ 35/46] net: revert 8728c544a9c ("net: dev_pick_tx() fix") Greg Kroah-Hartman
2013-09-12 17:58 ` [ 36/46] net: bridge: convert MLDv2 Query MRC into msecs_to_jiffies for max_delay Greg Kroah-Hartman
2013-09-12 17:58 ` [ 37/46] ICMPv6: treat dest unreachable codes 5 and 6 as EACCES, not EPROTO Greg Kroah-Hartman
2013-09-12 17:58 ` [ 38/46] tg3: Dont turn off led on 5719 serdes port 0 Greg Kroah-Hartman
2013-09-12 17:58 ` [ 39/46] vhost_net: poll vhost queue after marking DMA is done Greg Kroah-Hartman
2013-09-12 17:58 ` [ 40/46] ipv6: fix null pointer dereference in __ip6addrlbl_add Greg Kroah-Hartman
2013-09-12 17:58 ` [ 41/46] net: ipv6: tcp: fix potential use after free in tcp_v6_do_rcv Greg Kroah-Hartman
2013-09-12 17:58 ` [ 42/46] net: mvneta: properly disable HW PHY polling and ensure adjust_link() works Greg Kroah-Hartman
2013-09-12 17:58 ` [ 43/46] crypto: xor - Check for osxsave as well as avx in crypto/xor Greg Kroah-Hartman
2013-09-12 17:58 ` [ 44/46] drivers/rtc/rtc-max77686.c: Fix wrong register Greg Kroah-Hartman
2013-09-12 17:58 ` [ 45/46] mwifiex: do not create AP and P2P interfaces upon driver loading Greg Kroah-Hartman
2013-09-12 17:58 ` [ 46/46] ARM: at91: dt: sam9260: add i2c gpio pinctrl Greg Kroah-Hartman
2013-09-12 22:35 ` [ 00/46] 3.10.12-stable review Guenter Roeck
2013-09-12 23:07   ` Greg Kroah-Hartman
2013-09-13 23:02 ` Shuah Khan

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=20130912175722.075408798@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=stable@vger.kernel.org \
    --cc=stephen@networkplumber.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).