]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
batman-adv: tp_meter: prevent parallel modifications of last_recv
authorSven Eckelmann <sven@narfation.org>
Thu, 11 Jun 2026 06:04:13 +0000 (08:04 +0200)
committerSven Eckelmann <sven@narfation.org>
Sat, 13 Jun 2026 05:57:52 +0000 (07:57 +0200)
commit6dde0cfcb36e4d5b3de35b75696937478441eed4
tree1b13bcf5aa43edaae3c980ca86707a66ad1f68a7
parentd67c728f07fca2ee6ffdc6dd4421cf2e8691f4d1
batman-adv: tp_meter: prevent parallel modifications of last_recv

When last_recv is updated to store the last receive sequence number, it is
assuming that nothing is modifying in parallel while:

* check for outdated packets is done
* out of order check is performed (and packets are stored in out-of-order
  queue)
* the out-of-order queue was searched for closed gaps
* sequence number for next ack is calculated

Nothing of that was actually protected. It could therefore happen that the
last_recv was updated multiple times in parallel and the final sequence
number was calculated with deltas which had no connection to the sequence
number they were added to.

Lock this whole region with the same lock which was already used to protect
the unacked (out-of-order) list.

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
net/batman-adv/types.h