git: ba353c8950d5 - main - iflib: Drain configuration tasks before interface detach
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 14 Aug 2026 22:08:57 UTC
The branch main has been updated by kbowling:
URL: https://cgit.FreeBSD.org/src/commit/?id=ba353c8950d575f9d15b82c92658e660935fba25
commit ba353c8950d575f9d15b82c92658e660935fba25
Author: Nick Price <nprice@FreeBSD.org>
AuthorDate: 2026-08-08 06:17:16 +0000
Commit: Kevin Bowling <kbowling@FreeBSD.org>
CommitDate: 2026-08-14 22:08:36 +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.
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D58452
Co-authored-by: Andrew Gallatin <gallatin@FreeBSD.org>
Co-authored-by: Kevin Bowling <kbowling@FreeBSD.org>
---
sys/net/iflib.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 461ff0ba273e..cda60f174a31 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5658,6 +5658,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);