From nobody Mon Dec 23 22:00:39 2024 X-Original-To: dev-commits-src-all@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 4YHBm817jjz5hVcS; Mon, 23 Dec 2024 22:00:40 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YHBm75yNSz4HwR; Mon, 23 Dec 2024 22:00:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734991239; 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=gL4vAvQJG98MZU6dCzNbBpXncT6fv6pCmbjtA9TiAK4=; b=GgrkgIMJGdy8F/Co7Tz12yQgIvpQTVFZu9c4lvNj5RNcOgkd+7bLBv82P8HqyHgWqSfnik N/a0a+LqErRgWEmFOYTChATFOKMaQuvavPSozLeCjILVv5fL6De0ypWB2326l4TQ3VDkoW mvApvH3UIrQzvjqk2uwP7isx4Y4jj7uz2FIEe3UaOJnmAvOiSiGsFmO5PcZ4zq7wIWsuWR iEcm8ytxjf1Rr0S5OCq00v587stm0KIcRUGP/MIeFIfoQpejB5Z0gwQFLX8fhu3ymfo/JH +nqfG0cseyApOihqz4CN9zgnY3SxzZqVnkTIaPXmOzFk71F2NrCxfTAfid6/oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1734991239; 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=gL4vAvQJG98MZU6dCzNbBpXncT6fv6pCmbjtA9TiAK4=; b=M57o/lUteo5zJ8Z4+5YOpmd/BoImNE3jAiCeZ0Ipdi70qDWdQVxuQOx+voeLek6WWsMHMB Bf9h2gsQJBJ8BHNwCax1DJPDEmoIETnFcs08nste3VXZJYW3mOKWQ2GH6inNMbeDxXHsJs EZroG+fNXuF402ezmx2gNoAJpNHPnCp46Ff615tfkGz/oPZM/wASv+QEwXOOpzGFcK+T+h tM25CMe0clIc9TcuFt7CRvy+TFjCtr4GS+TfBNSfeF6E2gWTiFSCf0fzvnGXilYm18CchF ukzTKxEekO3m+YuLvTED1wfEXvXfQqgsxYj93E+4fOzVqfUYC1iVxNpcpjsfIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1734991239; a=rsa-sha256; cv=none; b=AU68KebC88GnE+lyYnNrrgHoRoKpj5PeeP0jXiHQkuUrqMTRtJa1vvUNIo5pqKwxbjaT3M tvij2aJoUPZ0bSot9+OJTVSfT2dWQ5ZahTX9NC8DLSpIEyxQ0GzQ9YhTc9HuLRs3O0lH67 rR/2W4ehj2O0p4ZilScbcDxnf39wjcK/0ss3j5wrkZxLhUtN+W48dhOQ5wgNk7aB/B9BzQ ZAnqUb1LZtcYQvBYZg8BlcfzMdUdBWd0EJIsfIm16mZe6hi5oZUGui0/lvE0HHUEo/ld6J 3G+3N6V+QXmzrIfkLAXVkUca4ZRRkjwzGOUPBbTm1Lv+a0vhMj3wj6k3mCn76g== 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 4YHBm75Wlmz1B1M; Mon, 23 Dec 2024 22:00:39 +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 4BNM0dND013289; Mon, 23 Dec 2024 22:00:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BNM0dX9013286; Mon, 23 Dec 2024 22:00:39 GMT (envelope-from git) Date: Mon, 23 Dec 2024 22:00:39 GMT Message-Id: <202412232200.4BNM0dX9013286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kevin Bowling Subject: git: 673cd5f450e2 - stable/14 - sfxge: defer ether_ifattach to when ifmedia_init is done List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 673cd5f450e25d3e2f8f0bea1d35e4adf69c7667 Auto-Submitted: auto-generated The branch stable/14 has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=673cd5f450e25d3e2f8f0bea1d35e4adf69c7667 commit 673cd5f450e25d3e2f8f0bea1d35e4adf69c7667 Author: Franco Fichtner AuthorDate: 2024-11-29 20:36:43 +0000 Commit: Kevin Bowling CommitDate: 2024-12-23 22:00:19 +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 (cherry picked from commit 0482974b2c021a8abbc044d3e2b1240250f791e7) --- 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