Skip to content

Commit

Permalink
tcp: Fix integer-overflows in TCP veno
Browse files Browse the repository at this point in the history
In veno we do a multiplication of the cwnd and the rtt. This
may overflow and thus their result is stored in a u64. However, we first
need to cast the cwnd so that actually 64-bit arithmetic is done.

A first attempt at fixing 76f1017 ([TCP]: TCP Veno congestion
control) was made by 1591311 (tcp: Overflow bug in Vegas), but it
failed to add the required cast in tcp_veno_cong_avoid().

Fixes: 76f1017 ([TCP]: TCP Veno congestion control)
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Christoph Paasch authored and davem330 committed Jul 31, 2014
1 parent 95cb574 commit 45a0769
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/tcp_veno.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static void tcp_veno_cong_avoid(struct sock *sk, u32 ack, u32 acked)

rtt = veno->minrtt;

target_cwnd = (tp->snd_cwnd * veno->basertt);
target_cwnd = (u64)tp->snd_cwnd * veno->basertt;
target_cwnd <<= V_PARAM_SHIFT;
do_div(target_cwnd, rtt);

Expand Down

0 comments on commit 45a0769

Please sign in to comment.