summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp_hybla.c
diff options
context:
space:
mode:
authorDaniele Lacamera <root@danielinux.net>2010-06-02 02:02:04 +0000
committerDavid S. Miller <davem@davemloft.net>2010-06-02 07:15:48 -0700
commitedafe502404f3669d364b6e96d79b54067b634b4 (patch)
treeef3c1a3921e20b2dc40938f2de23e893a6a53c4a /net/ipv4/tcp_hybla.c
parent33c29dde7d04dc0ec0edb649d20ccf1351c13a06 (diff)
TCP: tcp_hybla: Fix integer overflow in slow start increment
For large values of rtt, 2^rho operation may overflow u32. Clamp down the increment to 2^16. Signed-off-by: Daniele Lacamera <root@danielinux.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_hybla.c')
-rw-r--r--net/ipv4/tcp_hybla.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/tcp_hybla.c b/net/ipv4/tcp_hybla.c
index c209e054a634..377bc9349371 100644
--- a/net/ipv4/tcp_hybla.c
+++ b/net/ipv4/tcp_hybla.c
@@ -126,8 +126,8 @@ static void hybla_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
* calculate 2^fract in a <<7 value.
*/
is_slowstart = 1;
- increment = ((1 << ca->rho) * hybla_fraction(rho_fractions))
- - 128;
+ increment = ((1 << min(ca->rho, 16U)) *
+ hybla_fraction(rho_fractions)) - 128;
} else {
/*
* congestion avoidance