batman-adv: mcast: fix memory leak on deleting a batman-adv interface

Message ID (mailing list archive)
State Accepted, archived
Delegated to: Simon Wunderlich
Series batman-adv: mcast: fix memory leak on deleting a batman-adv interface |

Commit Message

Linus Lüssing Jan. 17, 2024, 5:22 a.m. UTC
  The batman-adv multicast tracker TVLV handler is registered for the
new batman-adv multicast packet type upon creating a batman-adv interface,
but not unregistered again upon the interface's deletion, leading to a
memory leak.

Fix this memory leak by calling the according TVLV handler unregister
routine for the multicast tracker TVLV upon batman-adv interface

Fixes: 8ed36122d709 ("batman-adv: mcast: implement multicast packet reception and forwarding")
Signed-off-by: Linus Lüssing <>
 net/batman-adv/multicast.c | 1 +
 1 file changed, 1 insertion(+)


diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c
index c8620905c2dc..38fab5e46ae2 100644
--- a/net/batman-adv/multicast.c
+++ b/net/batman-adv/multicast.c
@@ -2183,6 +2183,7 @@  void batadv_mcast_free(struct batadv_priv *bat_priv)
 	batadv_tvlv_container_unregister(bat_priv, BATADV_TVLV_MCAST, 2);
+	batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST_TRACKER, 1);
 	batadv_tvlv_handler_unregister(bat_priv, BATADV_TVLV_MCAST, 2);
 	/* safely calling outside of worker, as worker was canceled above */