From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 958C6606A681 for ; Sun, 6 Dec 2026 11:37:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=osuosl.org header.i=@osuosl.org header.a=rsa-sha256 header.s=default header.b=V3qiwWzo; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FdyhkuZ+ Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 6BE91406CB; Sun, 6 Dec 2026 11:37:54 +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 irttDzKauIu4; Sun, 6 Dec 2026 11:37:53 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp4.osuosl.org D62B7406C9 Authentication-Results: smtp4.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=1796557072; b=kqLTHVF5lZfggTg7dbbwYo92/zljDG23H+j0JFMr+7+5VPisdMm3DlIQD3A8F7tO/poW lQC4luiaczXPIWcnZAhI1oRNcyZJ1fcRYqWZlXQjuiwmGXIpMNxk2t/7CpXlYcngZACGT i6gvau5Gx/wrdTz6xkGMwdIKZ3qtR3g+4oEbSPwUiME3ZyhWDMi8NPScJsIOfePu8rpla zo3yeQAvEYGSUwqU2D8s91GFVAemGZIAwyi3X9rDK5/ZXFTrZ++0lMulXQNf0Ac1k24sU yrtUJFvCIB4StEJoeK2Yb8PptFNHm0W1wzPoEUCMGc6Y5VYQeAnQGQhVXLDY30XGLTg== ARC-Message-Signature: i=1; d=osuosl.org; s=arc; a=rsa-sha256; c=relaxed/relaxed; t=1796557072; 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: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=64TRVCEy0cGG/cp245xaQ/T4MmpY+WLefHnzTqgbfSI=; b=INdAjAWzb74B3MFDiZH26OJmK/4AzreQFPSilHODC3MdZZDWaxlfXwcmXUtPzQOYB7Mf hAUCxSNd8eSpWdAthY1FKQ0/hN3DOFJ7rVN3I0Yd3sq4tK+RQ7guwSqsWj99uy4OC88jW qMVDl5FQ+Y29oRxruKKS3o+oKf4nMArN1FUjxIxhSxTe8gEPLPEBnGAuqB80Nz4adRuLE 1rV79ThQeK+xmqQp9YA6NH71TzrcEJs2px8UTEOUe5CmiSOop32rGbKlcs3gNe5wxnv5d 1p93gK7sGEPkbWVSVeqpcf9FinV/Hbtfv/exQeA8wRBrU9NzU1OaFDWMnQxBS5Awf/A== ARC-Authentication-Results: i=1; smtp4.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=1796557072; bh=64TRVCEy0cGG/cp245xaQ/T4MmpY+WLefHnzTqgbfSI=; h=From:Subject:To:In-Reply-To:References:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: Reply-To:From; b=V3qiwWzol1FJjNkvg1MEDxs/hr6B2/7joW0N1nX14fXznVXsgM2cpBWOP7e2XW9r5 9ceOf2/lrlHLURXfMP9qcISw5E1nSg0GASvBTh6OQYh53ALepsFDf2CsN99dNZhDtf bFTyAoqZaCsgdaXo+sWTga0yVvgZGgiC+jMF5reOoUcqk26GmpOd0dTUm911CotEE0 ZfskAwjaJg84ZiNRAq1BTnPNF6ntqVGF9ir+ER6hO/nUew1tVvWAei6J+I7fVT7Fn3 02R2hK5UJMp4orDtTuuAMRDe6dwTYakTgrS9HCADmfCwxKv0YSgIul/OZf2OHui+0N 4v8BNyBoRrAMA== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp4.osuosl.org (Postfix) with ESMTP id D62B7406C9; Sun, 6 Dec 2026 11:37:52 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id C7FDD158 for ; Sun, 6 Dec 2026 11:37:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id B96826061E for ; Sun, 6 Dec 2026 11:37:51 +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 4fW57tsmFX5f for ; Sun, 6 Dec 2026 11:37:51 +0000 (UTC) ARC-Filter: OpenARC Filter v1.3.2 smtp3.osuosl.org E009E6061C Authentication-Results: smtp3.osuosl.org; arc=none smtp.remote-ip=172.234.252.31 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.252.31; helo=sea.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=FdyhkuZ+ Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by smtp3.osuosl.org (Postfix) with ESMTPS id E009E6061C for ; Sun, 6 Dec 2026 11:37:49 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id D370941A82; Sun, 6 Dec 2026 11:37:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A42BD1F0092B; Sun, 6 Dec 2026 11:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796557068; bh=64TRVCEy0cGG/cp245xaQ/T4MmpY+WLefHnzTqgbfSI=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=FdyhkuZ+9bSoAvFzLz3fZcfojqm1aJHQVRDzGQ1tJCD0hEX0yZvYdi93uNE8FyDbz x55PfUFMo59+IJGQscf+FKvrpVrdC6JIZdxEgsmFjNQiYtjs6u0LVEnW6ilVlFA82/ 71GaWxdTSXH+phWLQ4bHWfQU4WHAPxTFwTRQ5/06pqqPjlLh1A2nuyGL8SWvya7k7z x6aSlZao3nyfDo87vxYL4beeyYi0foqZZKB3vPt+dWEECRzQ3ZFENdeEeN77/QjMvp CjtnBn7cahmIlAwTS03XHEtH1hQxeQL+MG62VRU5ng1UXauN5xrZNoT6XKLT1hoRo4 +PSgGyLfqVUHQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH iwl-net 2/2] igb: restore hw_addr on resume after a failed register read To: =?utf-8?b?RnJhbsOnb2lzLVhhdmllciBHc2VsbA==?= , intel-wired-lan@lists.osuosl.org In-Reply-To: <20261205113710.1833153-3-fxgsell@gmail.com> References: <20261205113710.1833153-1-fxgsell@gmail.com> <20261205113710.1833153-3-fxgsell@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 11:37:48 +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.2 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 2 potential issues to consider: - [Medium] igb: hw_addr restored before pci_enable_device_mem() in __igb_resume() - [Low] igb: unmarked hw_addr write in __igb_resume() races with READ_ONCE() -- commit 334886b78bdce69dc089cafc1bf95f645f2e0b59 Author: Fran=C3=A7ois-Xavier Gsell igb: restore hw_addr on resume after a failed register read This commit restores hw->hw_addr from adapter->io_addr in __igb_resume() once pci_device_is_present() succeeds. > diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethe= rnet/intel/igb/igb_main.c > index dc59a429cb058..8451c79f61304 100644 > --- a/drivers/net/ethernet/intel/igb/igb_main.c > +++ b/drivers/net/ethernet/intel/igb/igb_main.c > @@ -9614,6 +9614,10 @@ static int __igb_resume(struct device *dev, bool r= pm) > =20 > if (!pci_device_is_present(pdev)) > return -ENODEV; > + > + /* A failed register read may have cleared hw_addr. */ > + hw->hw_addr =3D adapter->io_addr; > + > err =3D pci_enable_device_mem(pdev); > if (err) { > dev_err(&pdev->dev, [Severity: Medium] Should hw->hw_addr be restored after pci_enable_device_mem() succeeds rather than before it? If pci_enable_device_mem() fails, __igb_resume() returns an error while leaving hw->hw_addr non-NULL on a disabled PCI device. Later callers such as igb_remove() then bypass E1000_REMOVED(hw_addr) and issue MMIO accesses to a disabled device. During runtime resume, publishing hw->hw_addr before memory decoding is enabled also lets a concurrent reader without a runtime PM reference undo the recovery: CPU0 CPU1 igb_runtime_resume() __igb_resume() hw->hw_addr =3D adapter->io_addr igb_ptp_gettimex_i210() rd32(E1000_SYSTIMR) readl() -> 0xffffffff hw->hw_addr =3D NULL <-- clears again pci_enable_device_mem() Restoring hw->hw_addr right before igb_init_interrupt_scheme(), after pci_enable_device_mem() and pci_set_master() as igb_io_slot_reset() does, avoids both issues. [Severity: Low] Should this use WRITE_ONCE(hw->hw_addr, adapter->io_addr)? igb_rd32() and wr32() load hw->hw_addr locklessly with READ_ONCE(), while igb_runtime_resume() runs concurrently with readers like igb_ptp_gettimex_i210() without a shared lock. A plain store causes a KCSAN data race and permits store tearing of the pointer write. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205113710.1833= 153-1-fxgsell@gmail.com?part=3D2