]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
batman-adv: mcast: fix use-after-free in orig_node RCU release
authorSven Eckelmann <sven@narfation.org>
Thu, 14 May 2026 17:22:02 +0000 (19:22 +0200)
committerSven Eckelmann <sven@narfation.org>
Tue, 19 May 2026 06:44:24 +0000 (08:44 +0200)
commit20c2d6a20ca936f5aaa6dd40f73f262ac45c87cc
tree5d7430910bf353030cbeb4e5e0c5bed382b36370
parentff24f2ecfd94c07a2b89bac497433e3b23271cac
batman-adv: mcast: fix use-after-free in orig_node RCU release

batadv_mcast_purge_orig() removes entries from RCU-protected hlists but
does not wait for an RCU grace period before returning. Concurrent RCU
readers may still accesses references to those entries at the point of
removal. RCU-protected readers trying to operate on entries like
orig->mcast_want_all_ipv6_node will then access already freed memory.

Fix this by moving batadv_mcast_purge_orig() to batadv_orig_node_release(),
just before the call_rcu() invocation. This ensures RCU readers that were
active at purge time have drained before the orig_node memory is reclaimed.

Cc: stable@kernel.org
Fixes: ab49886e3da7 ("batman-adv: Add IPv4 link-local/IPv6-ll-all-nodes multicast support")
Acked-by: Linus Lüssing <linus.luessing@c0d3.blue>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/originator.c