The branch main has been updated by glebius:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=77939d64f23da4b0b599fad6edd967ffd1d17217

commit 77939d64f23da4b0b599fad6edd967ffd1d17217
Author:     Gleb Smirnoff <[email protected]>
AuthorDate: 2025-12-21 18:56:00 +0000
Commit:     Gleb Smirnoff <[email protected]>
CommitDate: 2025-12-22 02:23:14 +0000

    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 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);
 

Reply via email to