Skip to content

Commit f7af86c

Browse files
ecsvsimonwunderlich
authored andcommitted
batman-adv: Fix deletion of RTR(4|6) mcast list entries
The multicast code uses the lists bat_priv->mcast.want_all_rtr*_list to store all all originator nodes which don't have the flag no-RTR4 or no-RTR6 set. When an originator is purged, it has to be removed from these lists. Since all entries without the BATADV_MCAST_WANT_NO_RTR4/6 are stored in these lists, they have to be handled like entries which have these flags set to force the update routines to remove them from the lists when purging the originator. Not doing so will leave a pointer to a freed memory region inside the list. Trying to operate on these lists will then cause an use-after-free error: BUG: KASAN: use-after-free in batadv_mcast_want_rtr4_update+0x335/0x3a0 [batman_adv] Write of size 8 at addr ffff888007b41a38 by task swapper/0/0 Fixes: 61caf3d ("batman-adv: mcast: detect, distribute and maintain multicast router presence") Signed-off-by: Sven Eckelmann <[email protected]> Acked-by: Linus Lüssing <[email protected]> Signed-off-by: Simon Wunderlich <[email protected]>
1 parent fa3a03d commit f7af86c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net/batman-adv/multicast.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,8 +2420,10 @@ void batadv_mcast_purge_orig(struct batadv_orig_node *orig)
24202420
batadv_mcast_want_unsnoop_update(bat_priv, orig, BATADV_NO_FLAGS);
24212421
batadv_mcast_want_ipv4_update(bat_priv, orig, BATADV_NO_FLAGS);
24222422
batadv_mcast_want_ipv6_update(bat_priv, orig, BATADV_NO_FLAGS);
2423-
batadv_mcast_want_rtr4_update(bat_priv, orig, BATADV_NO_FLAGS);
2424-
batadv_mcast_want_rtr6_update(bat_priv, orig, BATADV_NO_FLAGS);
2423+
batadv_mcast_want_rtr4_update(bat_priv, orig,
2424+
BATADV_MCAST_WANT_NO_RTR4);
2425+
batadv_mcast_want_rtr6_update(bat_priv, orig,
2426+
BATADV_MCAST_WANT_NO_RTR6);
24252427

24262428
spin_unlock_bh(&orig->mcast_handler_lock);
24272429
}

0 commit comments

Comments
 (0)