Page MenuHomeFreeBSD

D62156.1795911594.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D62156.1795911594.diff

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5789,9 +5789,17 @@
return (0);
fail_detach:
+ /*
+ * The interface has been visible since ether_ifattach(), which runs
+ * without the context lock, so it may already be running or an ioctl
+ * may be waiting to start it. As in iflib_device_deregister(), mark
+ * the context inactive before dropping the lock so that nothing can
+ * start it from now on.
+ */
STATE_LOCK(ctx);
ctx->ifc_flags |= IFC_IN_DETACH;
STATE_UNLOCK(ctx);
+ ctx->ifc_pm_state = IFLIB_PM_SUSPENDING;
/* Tasks may need the context lock; ether_ifdetach() may sleep. */
CTX_UNLOCK(ctx);
taskqueue_drain_all(ctx->ifc_tq);
@@ -5811,6 +5819,13 @@
#endif
ether_ifdetach(ctx->ifc_ifp);
CTX_LOCK(ctx);
+ /*
+ * Stop the interface if it was started, or failed to start, before
+ * the context was marked inactive.
+ */
+ if (ctx->ifc_datapath_state != IFLIB_DP_UNKNOWN &&
+ ctx->ifc_datapath_state != IFLIB_DP_STOPPED)
+ iflib_stop(ctx);
goto fail_cleanup_detaching;
fail_cleanup:

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 29, 12:19 AM (23 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42078821
Default Alt Text
D62156.1795911594.diff (1 KB)

Event Timeline