From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 6BC8B606A330 for ; Fri, 4 Dec 2026 06:14:14 +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=a5/5qawP; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z8loGAns Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 4E1F260E4B; Fri, 4 Dec 2026 06:14:14 +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 7wu70uyN2ALF; Fri, 4 Dec 2026 06:14:12 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org 1B76C60E00 Authentication-Results: smtp3.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=1796364852; b=ZxO0RCNsrAhxZEOt6MiPQUcivjhgS9kyg9xHiEBpq20qwSlO+CXUZN3QFZ2pZsH2XeQK cJ6Gbzc1ckkNksE7yUamMAlaxvB+O6AKcTRYrJpPmX4EspGte9RilDhaZBoki4RHd71MR 6+9kE2qM3CV+efir3OBcgoYvO+fU9VPTO4YvtAEDn3tQCbMYuloRLA1nUFVYRn7UyBYYv SleOA+xPFh/G3Q4QwRLMCkizk6fyJ7cm1e8QldcA7pjc0ml0u2dX0pnjph7+FFiCkYKfP wH73gYKIRfPasxg9+96kUgj2nbqKXbr2Al3lmbcVRsx5anfsVSCTF/acIIThFi0FvQA== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796364852; 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=a62BVquLYiI58Fjvq3dB3LaJbiA5E8TAgnkRbArn1ws=; b=C4diydkcJZUE7gWacIMm4i7te1ROLo7Kj4B/it+EdMSoCKWeYc+Pv+xVsY5d6USjZqSV 1R8uYSiezl1DeOc2Rr0d3R++jDUxWcWlPKlPUqxXVt5ZcR0ADJSryqBocp2VJTp1FN9JR Kj7+kEiCcOQuqKrE6sqg7+WjX1W8pYc2JE6qe3WJt2Yj48vrl2qizjeSEZGyOMENJ5/Hu 31vA1765iDC1lxK5vFtNGPfvLRnDqj+/0F9EiWBQkpZ7Jj5Yq0DLCrl0Rg8miH1xZIbf5 wj0XkSiPB7MyFIDFAM5ILB0NmOnzTIP9Qdd9WABH1p/f8PSNuKGBlw/gjcdzvPWWcjw== ARC-Authentication-Results: i=1; smtp3.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=1796364852; bh=a62BVquLYiI58Fjvq3dB3LaJbiA5E8TAgnkRbArn1ws=; 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=a5/5qawPL5X1G76nYrCsjhjfY0dVmS8jsDzjkVL4ioNWbWI1OTKb/Sj0BJkGnYfR/ i/VcvBdKifyyACAfSoCh89uH9HJ17qM+5jpfZZFnn1Qj2atdsTfE4+dFcfm45dljgD ZrQpkJH9uz3BAwIn/Bvz4VEjRSy33we5nhZVMQO/mhNxBoOecRZ5HVTZGcPcoh95zU VDhQE/FYtUx0rTu8tJ73oGRvoW9PC7pkJ81jBBg0zzTsMnTS7zsAWiVdD0zvmfiO9x abgRZBWXI2a5YpVn8RX9CG4+1/A6SySUmYraCCWPSTU+qH0B2W0uMUpzdk8GCq+ACM 3Mj+aM2tPhL8w== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp3.osuosl.org (Postfix) with ESMTP id 1B76C60E00; Fri, 4 Dec 2026 06:14:12 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by lists1.osuosl.org (Postfix) with ESMTP id D2B869BA for ; Fri, 4 Dec 2026 06:14:09 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C534140430 for ; Fri, 4 Dec 2026 06:14:09 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id eG3E5Sue_hdv for ; Fri, 4 Dec 2026 06:14:08 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org A77E140311 Authentication-Results: smtp4.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: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=Z8loGAns Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by smtp4.osuosl.org (Postfix) with ESMTPS id A77E140311 for ; Fri, 4 Dec 2026 06:14:08 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 6E64161DF4; Fri, 4 Dec 2026 06:14:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E66D21F000CE; Fri, 4 Dec 2026 06:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796364846; bh=a62BVquLYiI58Fjvq3dB3LaJbiA5E8TAgnkRbArn1ws=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Z8loGAnsSA8vW6mzGgIYjRx2uywgX/BELxZ5tDTv30S6lYsq0xYMcoJlcB6EDS3tX wPu5TgtdvwYBPG0CIj2j17RUVJiXw4AZaFoW1nFwIdMgZaCFPcoLgaK6usIDEEhcxw iMb5pQXOR6/kxzFY9iqwkWtTyR9oIpG6M+pIO6vQLLJ78V8gawcvKGH5e3fIqaqDQ4 U8QIfsoNb5nwt2pZwNVKcORPert5dj1yUBF0QTknnxszzYRQewYPSOmYjBpXAAWogn 0Hr3JwCgfLfAjhNNQethUBX52KLOdzL71bex4QmB+j9XwurPD5hyijB1beXsYI4DeQ l6HEQu+aDN9SQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH iwl-next v2 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: <20261203-e1000-phylink-v2-2-0a8f80515363@telaak.dev> References: <20261203-e1000-phylink-v2-0-0a8f80515363@telaak.dev> <20261203-e1000-phylink-v2-2-0a8f80515363@telaak.dev> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 06:14:05 +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=-11.3 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_NONE,SPF_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 3 potential issues to consider: - [Medium] e1000: unlocked netif_running() races phylink start/resume/suspend with close - [Low] e1000: unlocked data race on adapter->phylink_up - [Low] e1000: e1000_probe() pulses PHY_RST when e1000_phylink_init() fails -- commit ba7508c7349c5b00062c75577f7323e893d36d78 Author: Joseph Telaak e1000: use phylink for a CE4100 fixed link This commit adds phylink support for CE4100 devices with a fixed-link OF node so the MAC forces speed, duplex, and flow control from phylink instead of scanning for an MDIO PHY. Link state, ethtool link and pause settings, and MII ioctls are delegated to phylink while guarding MAC register updates against resets and transmit setup with a mutex. > diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/= ethernet/intel/e1000/e1000_main.c > index a52fff0259a17..f07afc451d098 100644 > --- a/drivers/net/ethernet/intel/e1000/e1000_main.c > +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c [ ... ] > @@ -1182,8 +1348,14 @@ static int e1000_probe(struct pci_dev *pdev, const= struct pci_device_id *ent) > adapter->wol =3D adapter->eeprom_wol; > device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); > =20 > - /* Auto detect PHY address */ > if (hw->mac_type =3D=3D e1000_ce4100) { > + err =3D e1000_phylink_init(adapter); > + if (err) > + goto err_eeprom; > + } [ ... ] > @@ -1227,6 +1403,7 @@ static int e1000_probe(struct pci_dev *pdev, const = struct pci_device_id *ent) > err_register: > err_eeprom: > e1000_phy_hw_reset(hw); > + e1000_phylink_destroy(adapter); [Severity: Low] Does jumping to err_eeprom pulse E1000_CTRL_PHY_RST when e1000_phylink_init= () fails? If phylink_create() returns -EPROBE_DEFER (for example via phylink_parse_fixedlink() waiting on link-gpios), adapter->phylink is still NULL. At err_eeprom, e1000_phy_hw_reset() checks e1000_uses_phylink(hw), sees NULL, and asserts E1000_CTRL_PHY_RST for 10 ms plus the 10 ms wait in e1000_get_phy_cfg_done(), which can disrupt an externally managed peer on every deferred probe retry. Jumping past e1000_phy_hw_reset() (for instance to err_mdio_ioremap) when e1000_phylink_init() fails would avoid pulsing PHY_RST. [ ... ] > @@ -2397,6 +2586,9 @@ bool e1000_has_link(struct e1000_adapter *adapter) > struct e1000_hw *hw =3D &adapter->hw; > bool link_active =3D false; > =20 > + if (adapter->phylink) > + return adapter->phylink_up; > + [Severity: Low] Is there a data race on adapter->phylink_up here and in e1000_link_test()? e1000_mac_link_up() and e1000_mac_link_down() write adapter->phylink_up under adapter->phylink_lock from phylink_resolve() without rtnl_lock, while e1000_has_link() (from e1000_watchdog() and e1000_get_link()) and e1000_link_test() read it without adapter->phylink_lock or READ_ONCE(). During e1000_open(), firing E1000_ICS_LSC before phylink_start() runs e1000_watchdog() concurrently with phylink_resolve(), producing a KCSAN data race. Reading adapter->phylink_up under adapter->phylink_lock (as e1000_up= () does) or using READ_ONCE()/WRITE_ONCE() would resolve it. [ ... ] > @@ -5091,6 +5292,8 @@ static int __e1000_shutdown(struct pci_dev *pdev, b= ool *enable_wake) > =20 > WARN_ON(test_bit(__E1000_RESETTING, &adapter->flags)); > rtnl_lock(); > + if (adapter->phylink) > + phylink_suspend(adapter->phylink, !!adapter->wol); > e1000_down(adapter); > rtnl_unlock(); > } [ ... ] > @@ -5204,8 +5407,14 @@ static int e1000_resume(struct device *dev) > =20 > e1000_init_manageability(adapter); > =20 > - if (netif_running(netdev)) > + if (netif_running(netdev)) { > e1000_up(adapter); > + if (adapter->phylink) { > + rtnl_lock(); > + phylink_resume(adapter->phylink); > + rtnl_unlock(); > + } > + } [ ... ] > @@ -5329,6 +5541,11 @@ static void e1000_io_resume(struct pci_dev *pdev) > pr_info("can't bring device back up after reset\n"); > return; > } > + if (adapter->phylink) { > + rtnl_lock(); > + phylink_start(adapter->phylink); > + rtnl_unlock(); > + } > } [Severity: Medium] Can e1000_io_resume(), e1000_resume(), and __e1000_shutdown() race with e1000_close() because netif_running(netdev) is checked outside rtnl_lock()? __dev_close_many() allows e1000_close() to run under rtnl_lock() even while the netdev is detached: CPU0 CPU1 e1000_io_resume() if (netif_running(netdev)) e1000_up(adapter) dev_close() /* holds rtnl_lock */ __dev_close_many() e1000_close() phylink_stop(adapter->phylink) e1000_down(adapter) rtnl_lock() phylink_start(adapter->phylink) <-- started on closed netdev rtnl_unlock() This leaves phylink running on a closed interface. A later e1000_remove() skips e1000_close() because the interface is down, so phylink_destroy() frees pl and puts pl->link_gpio without stopping pl->link_poll or freeing pl->link_irq, causing a use-after-free and an IRQ leak. The same unlocked netif_running(netdev) check happens in e1000_resume() before phylink_resume(), and in __e1000_shutdown() before sleeping and calling phylink_suspend(). In __e1000_shutdown(), calling phylink_suspend() on a closed interface with WoL enabled leaves PHYLINK_DISABLE_MAC_WOL set because e1000_resume() will skip phylink_resume(). Holding rtnl_lock() across the netif_running(netdev) check, e1000_up()/e1000_down(), and the phylink call (matching e1000_io_error_detected()) would avoid these races. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-e1000-phyl= ink-v2-0-0a8f80515363@telaak.dev?part=3D2