]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
batman-adv: bla: only purge non-released claims
authorSven Eckelmann <sven@narfation.org>
Wed, 6 May 2026 20:20:51 +0000 (22:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 May 2026 15:16:33 +0000 (17:16 +0200)
commitab3dbd07a809a8eb30c7ddfab9ac886ed30dce8d
tree9853099dea8b94de7a02919c661a9405b998061a
parent0cc9847c64cb6e61118bc78c9187c8209a7197fa
batman-adv: bla: only purge non-released claims

commit cf6b604011591865ae39ac82de8978c1120d17af upstream.

When batadv_bla_purge_claims() goes through the list of claims, it is only
traversing the hash list with an rcu_read_lock(). Due to a potential
parallel batadv_claim_put(), it can happen that it encounters a claim which
was actually in the process of being released+freed by
batadv_claim_release(). In this case, backbone_gw is set to NULL before the
delayed RCU kfree is started. Calling batadv_bla_claim_get_backbone_gw() is
then no longer allowed because it would cause a NULL-ptr derefence.

To avoid this, only claims with a valid reference counter must be purged.
All others are already taken care of.

Cc: stable@kernel.org
Fixes: 23721387c409 ("batman-adv: add basic bridge loop avoidance code")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/batman-adv/bridge_loop_avoidance.c