The branch stable/15 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=92b851661bd024d2cb95e306537abaf2c972293f
commit 92b851661bd024d2cb95e306537abaf2c972293f Author: Nick Price <[email protected]> AuthorDate: 2026-08-08 06:17:16 +0000 Commit: Kevin Bowling <[email protected]> CommitDate: 2026-08-28 02:11:33 +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 a89b627b114c..b4e44321194a 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -5505,6 +5505,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);
