aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2025-12-21 18:56:00 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2025-12-22 02:23:14 +0000
commit77939d64f23da4b0b599fad6edd967ffd1d17217 (patch)
treecb32c8ea2b62ddc64a65da1ffe76b6b58a077b06
parent0e724de9ed6f2d2914cb79686a4ceee7f6dd31a1 (diff)
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
-rw-r--r--sys/net/if.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 3c16246e8b62..3394aa90127f 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);