git: 4f7473d18a62 - main - qlnx: fix panic at startup
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 13 Jun 2025 14:49:25 UTC
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;