aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrzemyslaw Lewandowski <przemyslawx.lewandowski@intel.com>2023-07-19 22:40:46 +0000
committerEric Joyner <erj@FreeBSD.org>2023-07-20 22:56:41 +0000
commit2617bca5a8c98e9e84fba3f2ebd9302e8e893b8f (patch)
treed3c0c0fd4b6836679c13aa7bae86e48cfdf336bf
parent58bc084de5a2155f34ffbd5fd3812fb432e1a72e (diff)
downloadsrc-2617bca5a8c98e9e84fba3f2ebd9302e8e893b8f.tar.gz
src-2617bca5a8c98e9e84fba3f2ebd9302e8e893b8f.zip
iflib: Unlock ctx lock around call to ether_ifattach()
Panic occurs during loading driver using kldload. It exists since netlink is enabled. There is problem with double locking ctx. This fix allows to call ether_ifattach() without locked ctx. Signed-off-by: Eric Joyner <erj@FreeBSD.org> PR: 271768 Reviewed by: erj@, jhb@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D40557 (cherry picked from commit a52f23f4c49e4766fb9eb0bf460cc83c5f63f17d)
-rw-r--r--sys/net/iflib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 3690be2b2a77..da4cc9addbe9 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5196,7 +5196,13 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
goto fail_queues;
}
+ /*
+ * It prevents a double-locking panic with iflib_media_status when
+ * the driver loads.
+ */
+ CTX_UNLOCK(ctx);
ether_ifattach(ctx->ifc_ifp, ctx->ifc_mac);
+ CTX_LOCK(ctx);
if ((err = IFDI_ATTACH_POST(ctx)) != 0) {
device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err);