Skip to content

Commit a924258

Browse files
edumazetSeth Forshee
authored andcommitted
tcp: fix wraparound issue in tcp_lp
BugLink: http://bugs.launchpad.net/bugs/1690814 [ Upstream commit a9f11f9 ] 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 <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Seth Forshee <[email protected]>
1 parent 5d4f057 commit a924258

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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, const struct ack_sample *sample)
264264
{
265265
struct tcp_sock *tp = tcp_sk(sk);
266266
struct lp *lp = inet_csk_ca(sk);
267+
u32 delta;
267268

268269
if (sample->rtt_us > 0)
269270
tcp_lp_rtt_sample(sk, sample->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)