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
This commit is contained in:
Eric Joyner 2023-07-19 15:40:46 -07:00
parent e5c4737955
commit a52f23f4c4
No known key found for this signature in database
GPG key ID: 96F0C6FD61E05DE3

View file

@ -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);