aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Joyner <erj@FreeBSD.org>2023-07-19 22:40:46 +0000
committerEric Joyner <erj@FreeBSD.org>2023-07-19 22:51:26 +0000
commita52f23f4c49e4766fb9eb0bf460cc83c5f63f17d (patch)
treed9667f25aea82574fd0733885b429bbc28aefaeb
parente5c4737955d54d868e73a22beae7e8bb15703779 (diff)
downloadsrc-a52f23f4c49e4766fb9eb0bf460cc83c5f63f17d.tar.gz
src-a52f23f4c49e4766fb9eb0bf460cc83c5f63f17d.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@ MFC after: 1 day Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D40557
-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 d056570d9a99..9f433481afda 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5386,7 +5386,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.octet);
+ CTX_LOCK(ctx);
if ((err = IFDI_ATTACH_POST(ctx)) != 0) {
device_printf(dev, "IFDI_ATTACH_POST failed %d\n", err);