Skip to content

Commit 0b83310

Browse files
edumazetgregkh
authored andcommitted
tcp: fix wraparound issue in tcp_lp
[ Upstream commit a9f11f963a546fea9144f6a6d1a307e814a387e7 ] Be careful when comparing tcp_time_stamp to some u32 quantity, otherwise result can be surprising. Fixes: 7c106d7 ("[TCP]: TCP Low Priority congestion control") Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6003cc5 commit 0b83310

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

net/ipv4/tcp_lp.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,15 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, s32 rtt_us)
264264
{
265265
struct tcp_sock *tp = tcp_sk(sk);
266266
struct lp *lp = inet_csk_ca(sk);
267+
u32 delta;
267268

268269
if (rtt_us > 0)
269270
tcp_lp_rtt_sample(sk, rtt_us);
270271

271272
/* calc inference */
272-
if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
273-
lp->inference = 3 * (tcp_time_stamp - tp->rx_opt.rcv_tsecr);
273+
delta = tcp_time_stamp - tp->rx_opt.rcv_tsecr;
274+
if ((s32)delta > 0)
275+
lp->inference = 3 * delta;
274276

275277
/* test if within inference */
276278
if (lp->last_drop && (tcp_time_stamp - lp->last_drop < lp->inference))

0 commit comments

Comments
 (0)