]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
batman-adv: tp_meter: handle seqno wrap-around for fast recovery detection
authorSven Eckelmann <sven@narfation.org>
Mon, 1 Jun 2026 09:47:29 +0000 (11:47 +0200)
committerSven Eckelmann <sven@narfation.org>
Wed, 3 Jun 2026 06:02:20 +0000 (08:02 +0200)
The recover variable and the last_sent sequence number are initialized on
purpose as a really high value which will wrap-around after the first 2000
bytes. The fast recovery precondition must therefore not use simple integer
comparisons but use helpers which are aware of the sequence number
wrap-arounds.

Cc: stable@kernel.org
Fixes: 33a3bb4a3345 ("batman-adv: throughput meter implementation")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/tp_meter.c

index ae6acbc60c8ed603389c2aa858b553b2628ce946..3d3d06c88e1c95b85d74b34b44a0dc752a232d9f 100644 (file)
@@ -733,7 +733,7 @@ static void batadv_tp_recv_ack(struct batadv_priv *bat_priv,
                if (atomic_read(&tp_vars->dup_acks) != 3)
                        goto out;
 
-               if (tp_vars->recover >= recv_ack)
+               if (!batadv_seq_before(tp_vars->recover, recv_ack))
                        goto out;
 
                /* if this is the third duplicate ACK do Fast Retransmit */