tcp_cubic: fix the range of delayed_ack
Subsystems (3)
PATCH 1/1 tcp_cubic: fix the range of delayed_ack
From: Liu Yu <[email protected]>
commit b9f47a3aaeab (tcp_cubic: limit delayed_ack ratio to prevent divide error) try to prevent divide error, but there is still a little chance that delayed_ack can reach zero. In case the param cnt get negative value, then ratio+cnt would overflow and may happen to be zero. As a result, min(ratio, ACK_RATIO_LIMIT) will calculate to be zero.
In some old kernels, such as 2.6.32, there is a bug that would pass negative param, which then ultimately leads to this divide error.
commit 5b35e1e6e9c (tcp: fix tcp_trim_head() to adjust segment count with skb MSS) fixed the negative param issue. However, it's safe that we fix the range of delayed_ack as well, to make sure we do not hit a divide by zero.
--- net/ipv4/tcp_cubic.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
net/ipv4/tcp_cubic.c +1 -1
@@ -409,7 +409,7 @@ static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us) ratio -= ca->delayed_ack >>ACK_RATIO_SHIFT ; ratio += cnt; - ca->delayed_ack =min (ratio,ACK_RATIO_LIMIT ); + ca->delayed_ack =clamp (ratio,1U ,ACK_RATIO_LIMIT ); }/* Some calls are for duplicates without timetamps */
Signature · 1 line
1.7.1
Quoted 16 lines · Liu Yu
From: Liu Yu <[email protected]>
commit
b9f47a3aaeab(tcp_cubic: limitdelayed_ackratio to prevent divide error) try to prevent divide error, but there is still a little chance thatdelayed_ackcan reach zero. In case the param cnt get negative value, then ratio+cnt would overflow and may happen to be zero. As a result,min(ratio, ACK_RATIO_LIMIT)will calculate to be zero.In some old kernels, such as 2.6.32, there is a bug that would pass negative param, which then ultimately leads to this divide error.
commit
5b35e1e6e9c(tcp: fixtcp_trim_head()to adjust segment count with skb MSS) fixed the negative param issue. However, it's safe that we fix the range ofdelayed_ackas well, to make sure we do not hit a divide by zero.
Quoted 5 lines
CC Stephen Hemminger <[email protected]>Signed-off-by Liu Yu <[email protected]>--- net/ipv4/tcp_cubic.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Thanks !
Quoted 17 lines · Eric Dumazet
Quoted 16 lines · Liu Yu
From: Liu Yu <[email protected]>
commit
b9f47a3aaeab(tcp_cubic: limitdelayed_ackratio to prevent divide error) try to prevent divide error, but there is still a little chance thatdelayed_ackcan reach zero. In case the param cnt get negative value, then ratio+cnt would overflow and may happen to be zero. As a result,min(ratio, ACK_RATIO_LIMIT)will calculate to be zero.In some old kernels, such as 2.6.32, there is a bug that would pass negative param, which then ultimately leads to this divide error.
commit
5b35e1e6e9c(tcp: fixtcp_trim_head()to adjust segment count with skb MSS) fixed the negative param issue. However, it's safe that we fix the range ofdelayed_ackas well, to make sure we do not hit a divide by zero.
Quoted 7 lines
Quoted 5 lines
CC Stephen Hemminger <[email protected]>Signed-off-by Liu Yu <[email protected]>--- net/ipv4/tcp_cubic.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Signed-off-by Eric Dumazet <[email protected]>
Indeed, thanks!
neal
David Miller
maintainerFrom: Liu Yu <[email protected]>
Date: Wed, 30 Apr 2014 17:34:09 +0800
Quoted 12 lines
From: Liu Yu <[email protected]>
commit
b9f47a3aaeab(tcp_cubic: limitdelayed_ackratio to prevent divide error) try to prevent divide error, but there is still a little chance thatdelayed_ackcan reach zero. In case the param cnt get negative value, then ratio+cnt would overflow and may happen to be zero. As a result,min(ratio, ACK_RATIO_LIMIT)will calculate to be zero.In some old kernels, such as 2.6.32, there is a bug that would pass negative param, which then ultimately leads to this divide error.
Quoted 7 lines
commit
5b35e1e6e9c(tcp: fixtcp_trim_head()to adjust segment count with skb MSS) fixed the negative param issue. However, it's safe that we fix the range ofdelayed_ackas well, to make sure we do not hit a divide by zero.CC Stephen Hemminger <[email protected]>Signed-off-by Liu Yu <[email protected]>
Applied and queued up for -stable, thanks.