git: 0482974b2c02 - main - sfxge: defer ether_ifattach to when ifmedia_init is done
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 02 Dec 2024 09:11:10 UTC
The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=0482974b2c021a8abbc044d3e2b1240250f791e7 commit 0482974b2c021a8abbc044d3e2b1240250f791e7 Author: Franco Fichtner <franco@opnsense.org> AuthorDate: 2024-11-29 20:36:43 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2024-12-02 09:09:24 +0000 sfxge: defer ether_ifattach to when ifmedia_init is done Otherwise the ifmedia subsystem may call unguarded NULL function pointers. Same issue that was fixed for cxgb(4) in f2daf8995. Also see: https://github.com/opnsense/src/issues/228 MFC after: 1 week --- sys/dev/sfxge/sfxge.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/dev/sfxge/sfxge.c b/sys/dev/sfxge/sfxge.c index 5fb3a3e74c2e..7d3217fb50de 100644 --- a/sys/dev/sfxge/sfxge.c +++ b/sys/dev/sfxge/sfxge.c @@ -611,8 +611,6 @@ sfxge_ifnet_init(if_t ifp, struct sfxge_softc *sc) if_sethwassistbits(ifp, CSUM_TCP | CSUM_UDP | CSUM_IP | CSUM_TSO | CSUM_TCP_IPV6 | CSUM_UDP_IPV6, 0); - ether_ifattach(ifp, encp->enc_mac_addr); - if_settransmitfn(ifp, sfxge_if_transmit); if_setqflushfn(ifp, sfxge_if_qflush); @@ -620,13 +618,11 @@ sfxge_ifnet_init(if_t ifp, struct sfxge_softc *sc) DBGPRINT(sc->dev, "ifmedia_init"); if ((rc = sfxge_port_ifmedia_init(sc)) != 0) - goto fail; + return (rc); - return (0); + ether_ifattach(ifp, encp->enc_mac_addr); -fail: - ether_ifdetach(sc->ifnet); - return (rc); + return (0); } void