]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 May 2026 15:16:32 +0000 (17:16 +0200)
commitd5851157bd2d96874c35c8f6a488d9eae1a392ca
treec29f324a1ea9ef319a26633da0ccea5632cad2ea
parent67bceeb22207f1f5a402973a3a0809e5f2698f38
batman-adv: tp_meter: fix tp_num leak on kmalloc failure

commit ce425dd05d0fe7594930a0fb103634f35ac47bb6 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/batman-adv/tp_meter.c