Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Feb 2026 14:33:52 +0000
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Cc:        Kristof Provost <kp@FreeBSD.org>
Subject:   git: baed1f130ab1 - stable/13 - qlnx: fix panic at startup
Message-ID:  <69a059d0.26920.4c001e4@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/13 has been updated by zlei:

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

commit baed1f130ab1ca0e553f2cb031f3cfd040ba3cfb
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-06-12 16:53:33 +0000
Commit:     Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2026-02-26 14:17:22 +0000

    qlnx: fix panic at startup
    
    While attaching the qlnx driver we can end up trying to call ifmedia functions
    before those are set up (through ether_ifattach() -> rtnl_handle_ifattach()
    -> dump_iface() -> get_operstate_ether() -> ifmedia_ioctl()). Postpone the
    ether_ifattach() until after the ifmedia setup.
    
    Reviewed by:    markj,zlei
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
    Differential Revision:  https://reviews.freebsd.org/D50819
    
    MFC note: qlnxe(4) does not exhibit panic at startup on stable/13, but
    there's a small windows that the setup of ifmedia has not been done but
    other threads try to access the ifmedia, since the ifnet is public
    visible on ether_ifattach(). Postpone ether_ifattach() until after the
    ifmedia setup to prevent that.
    
    (cherry picked from commit 4f7473d18a62077a218ac00817bae09a95b8cbcb)
    (cherry picked from commit 8ef7ad95e9156bea689274c9d57fc961b203efe2)
---
 sys/dev/qlnx/qlnxe/qlnx_os.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/qlnx/qlnxe/qlnx_os.c b/sys/dev/qlnx/qlnxe/qlnx_os.c
index 96a5e9e7e269..2586539617dd 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_os.c
+++ b/sys/dev/qlnx/qlnxe/qlnx_os.c
@@ -2387,9 +2387,6 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha)
 		ha->primary_mac[5] = (rnd >> 16) & 0xFF;
 	}
 
-	ether_ifattach(ifp, ha->primary_mac);
-	bcopy(IF_LLADDR(ha->ifp), ha->primary_mac, ETHER_ADDR_LEN);
-
 	ifp->if_capabilities = IFCAP_HWCSUM;
 	ifp->if_capabilities |= IFCAP_JUMBO_MTU;
 
@@ -2442,6 +2439,9 @@ qlnx_init_ifnet(device_t dev, qlnx_host_t *ha)
 
         ifmedia_set(&ha->media, (IFM_ETHER | IFM_AUTO));
 
+	ether_ifattach(ifp, ha->primary_mac);
+	bcopy(IF_LLADDR(ha->ifp), ha->primary_mac, ETHER_ADDR_LEN);
+
         QL_DPRINT2(ha, "exit\n");
 
         return;


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69a059d0.26920.4c001e4>