From nobody Mon Dec 02 09:11:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y1ygy4srvz5fvQ8; Mon, 02 Dec 2024 09:11:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1ygy4QKvz4GfC; Mon, 2 Dec 2024 09:11:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733130670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=acOMu0gb+eoyDqgUayL4KQqJ2UVmyNK8FDY+KEoEK8s=; b=tlDYGQYdVZ4DC0SbuXWHmNO2C+Ia8bLbFFRM3LsH7AWK1+m+BRwgfKYHVapk9U784rWDhM F1e7TU0w8CUtUs+95IpTX8u9AKX6ybTXHtCDxKEft9FLLf9mdB5aJTtme71h9hjk9kJBkO +ziwlSJGzp5KGoMCCl58jnF9WTipc9dGuNyzSOpF1aLoxGCssYuDgw7SqenUB+YTEo3FrQ yW8HRoR+nSVQickQ9X7VsNSZwxEm9XqwvKDld1+95QrodbpNwOeUQT2B7tpBi5D2E/+nVI uBcMvwMQc19ioRLeNv6RaAfSSddQ14DuA63rvaF2DjU8VHXRHuS85VIDRI1BAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733130670; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=acOMu0gb+eoyDqgUayL4KQqJ2UVmyNK8FDY+KEoEK8s=; b=onVqvAgt+UAouwniivT5wDnxtVSUDG56et6uHyrH9SHpQjmFRGrhyVAxS/D20Q7OyVd9Nl MByUI3vZc7MY/dgKWvw6Mijs+dPX5eHtP0GiKZJ89LePBVmkzcjCAYXb73QtCoxtOm3Xf3 eWzJKr/rzLjlR9QxrqmQ90iNm5H7Sv8csXAr9lY+KefTTO8Qxf1zmF99hW0UpNQoS0eu3O 4a72haEMOyZRgScthKULbh77zp+2YYmQLLn0/poY2cbcrY18qcsfxnwsreg9PGohUZhOi2 Tk+gGuy9oey1FdoE+aUmGnTk0SINeuVVFG1fVRW8dMRDKR1MiZicYcoq7lko0w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733130670; a=rsa-sha256; cv=none; b=FyvuaabWYz8Vp3bNAXkX0ZQgu01PPNob89/4J0mzyg4MFZl1yAnq9Dt3dkFEUISyu5lb3j fiePUz7TPk173tZYq3UkijpdeVGcqTg8R4tp3yMfuQq/xKMtEs7WLNDdr9RIOecScDmSiB 1rH1DgIPoGaRMFaCJr5YLGWWu1Ea+IZvtUDfUpteFq6teYteZxP42ZyjwnyFMPbwHTkVer 1CP7mUaSdlQTGgXmOzNoaLLWhvFHoFIg58kug1nlNEmyq0GpPakYKLDz50GI8gLH8Cr/rK SitkqUyfNRNLB4MMmbF8xmTPtwTQ/8tITmIYYCqCrgdxXBh6llBM9WBxQ1D9Jg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y1ygy3xMDzXP2; Mon, 2 Dec 2024 09:11:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B29BA0R059522; Mon, 2 Dec 2024 09:11:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B29BADA059519; Mon, 2 Dec 2024 09:11:10 GMT (envelope-from git) Date: Mon, 2 Dec 2024 09:11:10 GMT Message-Id: <202412020911.4B29BADA059519@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kevin Bowling Subject: git: 0482974b2c02 - main - sfxge: defer ether_ifattach to when ifmedia_init is done List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kbowling X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0482974b2c021a8abbc044d3e2b1240250f791e7 Auto-Submitted: auto-generated The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=0482974b2c021a8abbc044d3e2b1240250f791e7 commit 0482974b2c021a8abbc044d3e2b1240250f791e7 Author: Franco Fichtner AuthorDate: 2024-11-29 20:36:43 +0000 Commit: Kevin Bowling 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