Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jun 2025 14:49:25 GMT
From:      Kristof Provost <kp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4f7473d18a62 - main - qlnx: fix panic at startup
Message-ID:  <202506131449.55DEnPgE091027@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kp:

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

commit 4f7473d18a62077a218ac00817bae09a95b8cbcb
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-06-12 16:53:33 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2025-06-13 14:48:51 +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
---
 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 a984908abf34..05ec69a70dfe 100644
--- a/sys/dev/qlnx/qlnxe/qlnx_os.c
+++ b/sys/dev/qlnx/qlnxe/qlnx_os.c
@@ -2339,9 +2339,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_getlladdr(ha->ifp), ha->primary_mac, ETHER_ADDR_LEN);
-
 	if_setcapabilities(ifp, IFCAP_HWCSUM);
 	if_setcapabilitiesbit(ifp, IFCAP_JUMBO_MTU, 0);
 
@@ -2396,6 +2393,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_getlladdr(ha->ifp), ha->primary_mac, ETHER_ADDR_LEN);
+
         QL_DPRINT2(ha, "exit\n");
 
         return;



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