]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
batman-adv: tp_meter: keep unacked list in ascending ordered
authorSven Eckelmann <sven@narfation.org>
Thu, 28 May 2026 19:14:39 +0000 (21:14 +0200)
committerSven Eckelmann <sven@narfation.org>
Wed, 3 Jun 2026 06:02:18 +0000 (08:02 +0200)
When batadv_tp_handle_out_of_order inserts a new entry in the list of
unacked (out of order) packets, it searches from the entry with the newest
sequence number towards oldest sequence number. If an entry is found which
is older than the newly entry, the new entry has to be added after the
found one to keep the ascending order.

But for this operation list_add_tail() was used. But this function adds an
entry _before_ another one. As result, the list would contain a lot of
swapped sequence numbers. The consumer of this list
(batadv_tp_ack_unordered()) would then fail to correctly ack packets.

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 aefe757277b203031f3325ff112476e148cbfa09..0e39ea33e5f27dbd636b888f30ecb08a9965d48d 100644 (file)
@@ -1325,7 +1325,7 @@ static bool batadv_tp_handle_out_of_order(struct batadv_tp_vars *tp_vars,
                 * one is attached _after_ it. In this way the list is kept in
                 * ascending order
                 */
-               list_add_tail(&new->list, &un->list);
+               list_add(&new->list, &un->list);
                added = true;
                break;
        }