git: 8ef7ad95e915 - stable/14 - qlnx: fix panic at startup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Jul 2025 14:09:30 UTC
The branch stable/14 has been updated by zlei:
URL: https://cgit.FreeBSD.org/src/commit/?id=8ef7ad95e9156bea689274c9d57fc961b203efe2
commit 8ef7ad95e9156bea689274c9d57fc961b203efe2
Author: Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2025-06-12 16:53:33 +0000
Commit: Zhenlei Huang <zlei@FreeBSD.org>
CommitDate: 2025-07-20 14:07:19 +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
(cherry picked from commit 4f7473d18a62077a218ac00817bae09a95b8cbcb)
---
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 49d3f20aa0c2..fefddcbc3cea 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;