From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 082E8606A332 for ; Wed, 2 Dec 2026 07:21:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=FOwOkcet; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ai0voB8Q Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id DA10680F69; Wed, 2 Dec 2026 07:21:58 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id OJ5bIj_v6NcS; Wed, 2 Dec 2026 07:21:57 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp1.osuosl.org 8701980F7B Authentication-Results: smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 ARC-Seal: i=1; d=osuosl.org; s=arc; a=rsa-sha256; cv=none; t=1796196116; b=ioicFc7O7b7tJ7qdha7pHOdpUqcCs//ktAGyHg8fda2qKbpumbYf2yxt27u6OHlJX31H 9v+CP/e/gOVEwzXdAaq/kGYal1tLh4f+WTmeatk6pqPB96AYh/Ltkd1K/4Cx4m77ggUbh /z9Y6SaNfmDT+wHQSGshFeBJdfdf631GokT69yyGAU7vqOSP8T+jMfSrgT7USe0BkTaew A7xEvfWorSmal4/fbWK7gykE1pbYIMcqzd9ZX6W4a6P7sJy/fcA5FRSacuYg2M0XvvuM/ 40WLuOtAaZVEHdCwPMhmgd/9oKEwjuQ8HCQtEbJT4qz1ZNMSpN3FuWBqMxE70/2Qpiw== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796196116; h=X-Comment:DKIM-Signature:X-Original-To:Delivered-To:Received: Received:X-Virus-Scanned:X-Spam-Flag:X-Spam-Score:X-Spam-Level: X-Spam-Status:Received:ARC-Filter:Received-SPF:Received:Received: Received:DKIM-Signature:Message-ID:From:Subject:To:Cc:In-Reply-To: References:Content-Type:Content-Transfer-Encoding:Date:X-BeenThere: X-Mailman-Version:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:Reply-To:Errors-To; bh=PCcdLsOIQOUI4GEuQuAaEFe5Sxsaj6yF6SmOWm4DE6E=; b=WDdc2jjgsawqGInGEx2HuRcOYyj9CceavFk5aR9lmJMf3HSgeUD28F9tkMN0mcov+HGj Y1s9AMwKBY5SkK6gBl/EO8ov5eTMDeaAxajHfww0fluyNDACTNhtOEPbN+8olPGbqyFPG z8WjrCj650WPndAdwSeBV4h4DgvczkoWr5HAcPsvM19Xv0GxtGKLCcu9+NThPy6TEQFtP 4HaukmDk+NV5aZ26oECfHIXoVKB8DsW5iu62754+4EzIxWwo9fl0EaAyFh58VUGRuKBN4 /6jdbSeQnIecp36Vn99oleHLCrPvmb0L/ipET9sCZi/aT4n+qEWAFjZxHPQ4yD5YL0A== ARC-Authentication-Results: i=1; smtp1.osuosl.org; arc=none smtp.remote-ip=140.211.166.142 X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=intel-wired-lan-bounces@osuosl.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osuosl.org; s=default; t=1796196116; bh=PCcdLsOIQOUI4GEuQuAaEFe5Sxsaj6yF6SmOWm4DE6E=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=FOwOkcet+tFZWjRmug+ZVoIr9K/wJLfm9y0d3QpFG+L7rLVXDG0m7BVLdwCVP9zrp Fev2aKLKV4hoM2N3Cs3r0n4Hhec2nlfqH+FkgO4qcC8ZItB7J5LWMD25zH8ssNE/Uh OnAmt1FT/4zYkktHJP2V/1Nw+bAoClPz3xxX3qzeK7ZxCTmI+SOsK4KpNww4HYvbel L6oHW93cHaZHqCas6xS3Pt3d1PaChGs5Wx3yFTilfubYumj7y/wAjiYAyEbURRJ3C0 A324WdS2guPOfNxLTgLkXFXWq5OlwPQAmeWT1wSeZ8jkSdgfK4praSRxHc0VqsDcZA EHTilffVKTLDA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id 8701980F7B; Wed, 2 Dec 2026 07:21:56 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 0A8CD427 for ; Wed, 2 Dec 2026 07:21:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id F0C586076A for ; Wed, 2 Dec 2026 07:21:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 19tO5gL0N9F8 for ; Wed, 2 Dec 2026 07:21:54 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org C341B606A6 Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=172.105.4.254 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.4.254; helo=tor.source.kernel.org; envelope-from=sashiko-bot@kernel.org; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Ai0voB8Q Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by smtp3.osuosl.org (Postfix) with ESMTPS id C341B606A6 for ; Wed, 2 Dec 2026 07:21:53 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 383B560F0F; Wed, 2 Dec 2026 07:21:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF8281F00896; Wed, 2 Dec 2026 07:21:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796196111; bh=PCcdLsOIQOUI4GEuQuAaEFe5Sxsaj6yF6SmOWm4DE6E=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Ai0voB8QSqBuYdqrtM40mDxqd0s9wtm95/TvZWCXR1YinI9c7im6KaKAkugspQxit 6zD+UcfPciPzhmgkjC6cNQOah7NXKs7EpvFM3alU4aEkxHruTix9+Iv/+ZP51xBYWe LQUSXnOiF7RG+xl3HlW/AwGPlspxfRQl+27ApJXOg08NLY1hZoI1AquvtFa4tiNuVZ 5HMmaH4dmJJas+Y3ydJ7Hpml9eTmGQcY90szLPAeND1sshd0wxisMISVxTeqApgGOy cGWSNJ9bwmz19g3OVIJSuVw6a3jKl3WX2zsLJ8dl1sICzmGc/j1saEpf2/69MEhfth C2lBS0WInNbSg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH iwl-next 2/4] e1000: use phylink for a CE4100 fixed link To: "Joseph Telaak" Cc: intel-wired-lan@lists.osuosl.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261201-e1000-phylink-v1-2-21e6f1c816a0@telaak.dev> References: <20261201-e1000-phylink-v1-0-21e6f1c816a0@telaak.dev> <20261201-e1000-phylink-v1-2-21e6f1c816a0@telaak.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 07:21:51 +0000 X-BeenThere: intel-wired-lan@osuosl.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Intel Wired Ethernet Linux Kernel Driver Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] e1000: race on TCTL transmit disable between e1000_down() and e1000_mac_link_up() It also noticed 1 related pre-existing issue this patch does not introduce: - [Critical] e1000: use-after-free in e1000_remove() [1] -- commit 98cabf3b3791ddf89994822f980e3b1c0d669af1 Author: Joseph Telaak e1000: use phylink for a CE4100 fixed link This commit adds phylink support for CE4100 GbE MAC devices configured with an RGMII fixed-link in Device Tree, delegating link state, ethtool settings, and MII ioctls to phylink. > diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/= ethernet/intel/e1000/e1000_main.c > index a52fff0259a17..2343252b89fa6 100644 > --- a/drivers/net/ethernet/intel/e1000/e1000_main.c > +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c [ ... ] > @@ -901,6 +933,131 @@ static int e1000_init_hw_struct(struct e1000_adapte= r *adapter, > return 0; > } > =20 > +static struct e1000_adapter *e1000_from_phylink(struct phylink_config *c= onfig) > +{ > + return netdev_priv(to_net_dev(config->dev)); > +} > + > +static void e1000_mac_config(struct phylink_config *config, unsigned int= mode, > + const struct phylink_link_state *state) > +{ > +} > + > +static void e1000_mac_link_down(struct phylink_config *config, > + unsigned int mode, phy_interface_t interface) > +{ > + struct e1000_adapter *adapter =3D e1000_from_phylink(config); > + struct e1000_hw *hw =3D &adapter->hw; > + > + mutex_lock(&adapter->phylink_lock); > + adapter->phylink_up =3D false; > + adapter->link_speed =3D 0; > + adapter->link_duplex =3D 0; > + ew32(TCTL, er32(TCTL) & ~E1000_TCTL_EN); > + mutex_unlock(&adapter->phylink_lock); > +} > + > +static void e1000_mac_link_up(struct phylink_config *config, > + struct phy_device *phy, unsigned int mode, > + phy_interface_t interface, int speed, int duplex, > + bool tx_pause, bool rx_pause) > +{ > + struct e1000_adapter *adapter =3D e1000_from_phylink(config); > + struct e1000_hw *hw =3D &adapter->hw; > + > + mutex_lock(&adapter->phylink_lock); > + hw->forced_speed =3D speed; > + hw->forced_full_duplex =3D duplex =3D=3D DUPLEX_FULL; > + if (tx_pause && rx_pause) > + hw->fc =3D E1000_FC_FULL; > + else if (tx_pause) > + hw->fc =3D E1000_FC_TX_PAUSE; > + else if (rx_pause) > + hw->fc =3D E1000_FC_RX_PAUSE; > + else > + hw->fc =3D E1000_FC_NONE; > + hw->original_fc =3D hw->fc; > + > + e1000_setup_forced_link(hw); > + e1000_set_fc_watermarks(hw); > + > + adapter->link_speed =3D speed; > + adapter->link_duplex =3D duplex =3D=3D DUPLEX_FULL ? FULL_DUPLEX : > + HALF_DUPLEX; > + adapter->tx_timeout_factor =3D speed =3D=3D SPEED_10 ? 16 : 1; > + adapter->phylink_up =3D true; > + > + if (!test_bit(__E1000_DOWN, &adapter->flags)) > + ew32(TCTL, er32(TCTL) | E1000_TCTL_EN); > + mutex_unlock(&adapter->phylink_lock); > +} [Severity: Medium] Can e1000_mac_link_up() race with e1000_down() and re-enable E1000_TCTL_EN while the adapter is being brought down? During an online reset or reconfiguration (such as e1000_reinit_locked() or e1000_change_mtu()), phylink remains running while e1000_down() executes. e1000_down() clears E1000_TCTL_EN without holding adapter->phylink_lock and only sets __E1000_DOWN after sleeping for 10ms and disabling NAPI and IRQs: CPU0 CPU1 (kworker) e1000_reinit_locked() e1000_down() tctl =3D er32(TCTL); tctl &=3D ~E1000_TCTL_EN; ew32(TCTL, tctl); msleep(10); phylink_resolve() e1000_mac_link_up() mutex_lock(&adapter->phylink_lock= ); if (!test_bit(__E1000_DOWN, ...)) ew32(TCTL, er32(TCTL) | E1000_TCTL_EN= ); <-- TX re-enabled mid-tear= down mutex_unlock(&adapter->phylink_lo= ck); ... e1000_down_and_stop() set_bit(__E1000_DOWN, ...); This re-enables hardware transmit DMA while e1000_down() proceeds to disable NAPI and interrupts, reset the MAC, and clean the TX rings. [ ... ] > @@ -1270,6 +1436,8 @@ static void e1000_remove(struct pci_dev *pdev) > =20 > unregister_netdev(netdev); > =20 > + e1000_phylink_destroy(adapter); > + > /* Only kill reset task if adapter is not resetting */ > if (!test_bit(__E1000_RESETTING, &adapter->flags)) > cancel_work_sync(&adapter->reset_task); [Severity: Critical] This problem wasn't introduced by this patch, but skipping cancel_work_sync(&adapter->reset_task) when __E1000_RESETTING is set [1] allows e1000_remove() to call free_netdev() while adapter->reset_task is still running or pending, causing a use-after-free in e1000_reset_task(). [1] https://sashiko.dev/#/bug/linux-07ec582b-3a47-4b03-b81c-05ee2026cfe7 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261201-e1000-phyl= ink-v1-0-21e6f1c816a0@telaak.dev?part=3D2