Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 062D9219E93 for ; Wed, 26 Feb 2025 02:24:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536656; cv=none; b=t/0h3+gE+oyjeKiU6+tuh1I/i6572hTXNok2Giupzc61JBfM9Yr64kJYyQVSqaXN3E1BhOC03002bFfNmrf4GPMZQVlWXq0bqMgQ/zpypDh5PS1SiaeVafZD2OB/BxA2BweE/77L4KohSiUp5hzo3qt6J9tOvptjrur5RelCO9M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536656; c=relaxed/simple; bh=JfHB81+t5ozgSM43TD8JOpAcehXii9/gGIiaip4oqbo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=h2M6ycJ7+hcoX0AKDzhNw1GnDYLfntm/vvwmACICqVVMLocNU3v4skHGftueDyOI/IvVVf11O3jaFVpvnGKHJlfnqKyMC5Ttb83Ot0HkUwwtDGP3sUN1UxV4TvzCi1RJeCJd0W/uYX+Lq3jHwjsTZ2YQBspGyS+a6loxnPgZ1OA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vqx3XJYW; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="vqx3XJYW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD58DC4CEDD; Wed, 26 Feb 2025 02:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740536655; bh=JfHB81+t5ozgSM43TD8JOpAcehXii9/gGIiaip4oqbo=; h=From:To:Cc:Subject:Date:Reply-to:From; b=vqx3XJYWoyp+J6RRvIaFwgyrKhFJmpdNamqU6pRsR6SyVHrL2fq6J4t+MGK9HYaTf fhj3mZQJCgxVnblB8wR/OD3Ea3M7uwlArKPYDySWU0TU+rGX82AXb6cMdPE2A6v1Dv g1Oumk85paTf7R0pFPxiR5LKKZwyAB1FxHR5cnNo= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49605: igc: Reinstate IGC_REMOVED logic and implement it properly Date: Wed, 26 Feb 2025 03:22:48 +0100 Message-ID: <2025022612-CVE-2022-49605-fef2@gregkh> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=4664; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=JfHB81+t5ozgSM43TD8JOpAcehXii9/gGIiaip4oqbo=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7qq6UT+LjKd3Dm7DX4sadD9vk37jKdJ+oYHf9Ks4sW +9usHhlRywLgyATg6yYIsuXbTxH91ccUvQytD0NM4eVCWQIAxenAEwknpVhvpP1kf0tO6cYtv5R 2ZJpHLZI63XpM4YFayW8U/e8LNrvmtO995/CP5cmd9HfAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: igc: Reinstate IGC_REMOVED logic and implement it properly The initially merged version of the igc driver code (via commit 146740f9abc4, "igc: Add support for PF") contained the following IGC_REMOVED checks in the igc_rd32/wr32() MMIO accessors: u32 igc_rd32(struct igc_hw *hw, u32 reg) { u8 __iomem *hw_addr = READ_ONCE(hw->hw_addr); u32 value = 0; if (IGC_REMOVED(hw_addr)) return ~value; value = readl(&hw_addr[reg]); /* reads should not return all F's */ if (!(~value) && (!reg || !(~readl(hw_addr)))) hw->hw_addr = NULL; return value; } And: #define wr32(reg, val) \ do { \ u8 __iomem *hw_addr = READ_ONCE((hw)->hw_addr); \ if (!IGC_REMOVED(hw_addr)) \ writel((val), &hw_addr[(reg)]); \ } while (0) E.g. igb has similar checks in its MMIO accessors, and has a similar macro E1000_REMOVED, which is implemented as follows: #define E1000_REMOVED(h) unlikely(!(h)) These checks serve to detect and take note of an 0xffffffff MMIO read return from the device, which can be caused by a PCIe link flap or some other kind of PCI bus error, and to avoid performing MMIO reads and writes from that point onwards. However, the IGC_REMOVED macro was not originally implemented: #ifndef IGC_REMOVED #define IGC_REMOVED(a) (0) #endif /* IGC_REMOVED */ This led to the IGC_REMOVED logic to be removed entirely in a subsequent commit (commit 3c215fb18e70, "igc: remove IGC_REMOVED function"), with the rationale that such checks matter only for virtualization and that igc does not support virtualization -- but a PCIe device can become detached even without virtualization being in use, and without proper checks, a PCIe bus error affecting an igc adapter will lead to various NULL pointer dereferences, as the first access after the error will set hw->hw_addr to NULL, and subsequent accesses will blindly dereference this now-NULL pointer. This patch reinstates the IGC_REMOVED checks in igc_rd32/wr32(), and implements IGC_REMOVED the way it is done for igb, by checking for the unlikely() case of hw_addr being NULL. This change prevents the oopses seen when a PCIe link flap occurs on an igc adapter. The Linux kernel CVE team has assigned CVE-2022-49605 to this issue. Affected and fixed versions =========================== Issue introduced in 4.20 with commit 146740f9abc4976e4f0af1aa302efee1c699d2e4 and fixed in 5.4.208 with commit 16cb6717f4f42487ef10583eb8bc98e7d1e33d65 Issue introduced in 4.20 with commit 146740f9abc4976e4f0af1aa302efee1c699d2e4 and fixed in 5.10.134 with commit 77836dbe35382aaf8108489060c5c89530c77494 Issue introduced in 4.20 with commit 146740f9abc4976e4f0af1aa302efee1c699d2e4 and fixed in 5.15.58 with commit e75b73081f1ec169518773626c2ff3950476660b Issue introduced in 4.20 with commit 146740f9abc4976e4f0af1aa302efee1c699d2e4 and fixed in 5.18.15 with commit 70965b6e5c03aa70cc754af1226b9f9cde0c4bf3 Issue introduced in 4.20 with commit 146740f9abc4976e4f0af1aa302efee1c699d2e4 and fixed in 5.19 with commit 7c1ddcee5311f3315096217881d2dbe47cc683f9 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2022-49605 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/net/ethernet/intel/igc/igc_main.c drivers/net/ethernet/intel/igc/igc_regs.h Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/16cb6717f4f42487ef10583eb8bc98e7d1e33d65 https://git.kernel.org/stable/c/77836dbe35382aaf8108489060c5c89530c77494 https://git.kernel.org/stable/c/e75b73081f1ec169518773626c2ff3950476660b https://git.kernel.org/stable/c/70965b6e5c03aa70cc754af1226b9f9cde0c4bf3 https://git.kernel.org/stable/c/7c1ddcee5311f3315096217881d2dbe47cc683f9