The branch stable/14 has been updated by kbowling:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=546e2c0380c48ad0a05db5386fc2952d2fe2f13c

commit 546e2c0380c48ad0a05db5386fc2952d2fe2f13c
Author:     Nick Price <[email protected]>
AuthorDate: 2026-08-08 06:17:16 +0000
Commit:     Kevin Bowling <[email protected]>
CommitDate: 2026-08-28 02:20:56 +0000

    iflib: Drain configuration tasks before interface detach
    
    iflib_device_deregister() sets IFC_IN_DETACH before removing the
    interface, but a task which already passed its detach check can still
    report a link change.  This can re-arm if_linktask after
    ether_ifdetach() has drained it and leave work pending across queue
    teardown.
    
    Drain the entire private taskqueue before ether_ifdetach().  Drivers
    may register their own link-related configuration tasks there, so
    draining only the framework admin task leaves the same race for those
    drivers.
    
    Differential Revision:  https://reviews.freebsd.org/D58452
    
    Co-authored-by: Andrew Gallatin <[email protected]>
    Co-authored-by: Kevin Bowling <[email protected]>
    (cherry picked from commit ba353c8950d575f9d15b82c92658e660935fba25)
---
 sys/net/iflib.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 6889c91f3669..0eb4b86542cb 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5645,6 +5645,13 @@ iflib_device_deregister(if_ctx_t ctx)
        iflib_unregister_vlan_handlers(ctx);
 
        iflib_netmap_detach(ifp);
+       /*
+        * A task that passed its IFC_IN_DETACH check before the flag was set
+        * can still report a link change.  Drain every private task before
+        * ether_ifdetach() performs the final if_linktask drain.  Drivers may
+        * register their own link-related tasks on this taskqueue.
+        */
+       taskqueue_drain_all(ctx->ifc_tq);
        ether_ifdetach(ifp);
 
        CTX_LOCK(ctx);

Reply via email to