]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
batman-adv: tp_meter: fix tp_num leak on kmalloc failure
authorSven Eckelmann <sven@narfation.org>
Wed, 6 May 2026 20:20:49 +0000 (22:20 +0200)
committerSven Eckelmann <sven@narfation.org>
Fri, 8 May 2026 12:28:44 +0000 (14:28 +0200)
commitce425dd05d0fe7594930a0fb103634f35ac47bb6
tree61497a341fbd05b63617e755236903a615c0a863
parentf03e8583532941b07761c5429de7d50766fa3110
batman-adv: tp_meter: fix tp_num leak on kmalloc failure

When batadv_tp_start() or batadv_tp_init_recv() fail to allocate a new
tp_vars object, the previously incremented bat_priv->tp_num counter is
never decremented. This causes tp_num to drift upward on each allocation
failure. Since only BATADV_TP_MAX_NUM sessions can be started and the count
is never reduced for these failed allocations, it causes to an exhaustion
of throughput meter sessions. In worst case, no new throughput meter
session can be started until the mesh interface is removed.

The error handling must decrement tp_num releasing the lock and aborting
the creation of an throughput meter session

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