From 77939d64f23da4b0b599fad6edd967ffd1d17217 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Sun, 21 Dec 2025 10:56:00 -0800 Subject: [PATCH] net: on interface detach purge multicast addresses after protocols We first want to give a chance to all owners of multicast addresses to free them and only then run through the list of remaining ones. It might be that no addresses remain there normally, but this needs to be analyzed deeper. For now restore the sequence that was before 0d469d23715d to fix a possible use after free. Fixes: 0d469d23715d690b863787ebfa51529e1f6a9092 --- sys/net/if.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index 3c16246e8b6..3394aa90127 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1117,9 +1117,8 @@ if_detach_internal(struct ifnet *ifp, bool vmove) #endif if_purgeaddrs(ifp); - if_purgemaddrs(ifp); - EVENTHANDLER_INVOKE(ifnet_departure_event, ifp); + if_purgemaddrs(ifp); if (IS_DEFAULT_VNET(curvnet)) devctl_notify("IFNET", ifp->if_xname, "DETACH", NULL);