netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] TCP: tcp_hybla: Fix integer overflow in slow start increment
@ 2010-06-02 12:02 Daniele Lacamera
  2010-06-02 14:16 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Daniele Lacamera @ 2010-06-02 12:02 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuznet, root, linux-kernel

From: root <root@kitchen.(none)>

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>
---
 net/ipv4/tcp_hybla.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/tcp_hybla.c b/net/ipv4/tcp_hybla.c
index c209e05..8db01d4 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
-- 
1.5.6.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] TCP: tcp_hybla: Fix integer overflow in slow start increment
  2010-06-02 12:02 [PATCH] TCP: tcp_hybla: Fix integer overflow in slow start increment Daniele Lacamera
@ 2010-06-02 14:16 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-06-02 14:16 UTC (permalink / raw)
  To: root; +Cc: netdev, kuznet, linux-kernel

From: Daniele Lacamera <root@danielinux.net>
Date: Wed,  2 Jun 2010 14:02:04 +0200

> From: root <root@kitchen.(none)>

Please do not include incomplete authorship tags in your patch postings
like this, I used the more complete one from your email headers.

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-02 14:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-02 12:02 [PATCH] TCP: tcp_hybla: Fix integer overflow in slow start increment Daniele Lacamera
2010-06-02 14:16 ` David Miller

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).