Re: [PATCH RFC batadv] batman-adv: mcast: fix use-after-free in orig_node RCU release
Linus Lüssing <[email protected]>
| Newsgroups | org.open-mesh.lists.batman |
|---|---|
| Message-ID | <agouTnSEU6CuTF5i@sellars> |
On Thu, May 14, 2026 at 07:41:38PM +0200, Sven Eckelmann wrote:
> 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.
>
> Fixes: 1c090349e2f6 ("batman-adv: Add IPv4 link-local/IPv6-ll-all-nodes multicast support")
> Signed-off-by: Sven Eckelmann <[email protected]>
Makes sense to me now and does not seem to crash on my laptop with
Debian Sid in a simple batadv/veth setup.
Acked-by: Linus Lüssing <[email protected]>