Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jul 2023 22:48:16 GMT
From:      Eric Joyner <erj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 93f39b467586 - stable/13 - iflib: Unlock ctx lock around call to ether_ifattach()
Message-ID:  <202307202248.36KMmGEW035256@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by erj:

URL: https://cgit.FreeBSD.org/src/commit/?id=93f39b4675865094b298e1fca5bcfa788348dd36

commit 93f39b4675865094b298e1fca5bcfa788348dd36
Author:     Przemyslaw Lewandowski <przemyslawx.lewandowski@intel.com>
AuthorDate: 2023-07-19 22:40:46 +0000
Commit:     Eric Joyner <erj@FreeBSD.org>
CommitDate: 2023-07-20 22:42:22 +0000

    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)
---
 sys/net/iflib.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/net/iflib.c b/sys/net/iflib.c
index 748970a58f3f..cba931f1b2a7 100644
--- a/sys/net/iflib.c
+++ b/sys/net/iflib.c
@@ -5349,7 +5349,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307202248.36KMmGEW035256>