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 1FAAE26C3B3 for ; Fri, 9 May 2025 06:43:37 +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=1746773018; cv=none; b=XJzhjnEnLMv1vC/rIl2IAQhSs6FKC9nzSZ23jp7fTsqSPUeDIFGI97YUBCv24wjDCyDBErFJa2lNzR+APt0Bq01H4EiadutiE7uLzURofBijoMWDBe3n2WuVaDleJclaaXyc9fyJfSnsqd5txB1Qf9WDQNcBpsUAPuLmCeVHKXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746773018; c=relaxed/simple; bh=x4VujVVxyTn2M9TDzY7uz5AYwHxV82PhpTClMZwlBJ0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SAlR+gxX1AjMQpJyhDrT6eLAOp7O3KvWWy2JqqMi6nt6fn5L4pskYUvE9n104FVdtMGlTUdItj1qhzYqcDwG1ncwHY03g0k6DfBhb6c32kNYh+ZpQa8uull8db/oxe+pzveOy+RtRbq9oUFvYsP9sd9kQ7X/owjHwzblUudUu7U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XO7mSrCk; 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="XO7mSrCk" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B2ABC4CEE4; Fri, 9 May 2025 06:43:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1746773017; bh=x4VujVVxyTn2M9TDzY7uz5AYwHxV82PhpTClMZwlBJ0=; h=From:To:Cc:Subject:Date:Reply-to:From; b=XO7mSrCkfkxBzj1VJaY7PkfV04Jt+CkOI9CcX5leQBbK2wdnLQ60i/PfZUxvlj7AX aZ5xWjU8wk0iZAX+BkIfFSx8uG44TGfHwExGyjjPQ/wk1OCa/n42WhNtSbkBUPBIUD Mlaug536FquF9pfbgqLZNBU1FusSylNDQtByP8fE= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-37843: PCI: pciehp: Avoid unnecessary device replacement check Date: Fri, 9 May 2025 08:42:21 +0200 Message-ID: <2025050916-CVE-2025-37843-6b22@gregkh> X-Mailer: git-send-email 2.49.0 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=4031; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=6dB7X0zmfylSGvnD7r6zu5B39004hIrVPdpzAtD9umU=; b=owGbwMvMwCRo6H6F97bub03G02pJDBmyi0+E/y1K8r1TYC+06Pa21TE/7d9MD1oof0rS582Jp StepG3S6ohlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJHH3IMD/uUO2/y433Ag6w qcVHX6h22j334iaGeZam1u881kcnmcjNX/dhwWLlGvGnPwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit From: Greg Kroah-Hartman Description =========== In the Linux kernel, the following vulnerability has been resolved: PCI: pciehp: Avoid unnecessary device replacement check Hot-removal of nested PCI hotplug ports suffers from a long-standing race condition which can lead to a deadlock: A parent hotplug port acquires pci_lock_rescan_remove(), then waits for pciehp to unbind from a child hotplug port. Meanwhile that child hotplug port tries to acquire pci_lock_rescan_remove() as well in order to remove its own children. The deadlock only occurs if the parent acquires pci_lock_rescan_remove() first, not if the child happens to acquire it first. Several workarounds to avoid the issue have been proposed and discarded over the years, e.g.: https://lore.kernel.org/r/4c882e25194ba8282b78fe963fec8faae7cf23eb.1529173804.git.lukas@wunner.de/ A proper fix is being worked on, but needs more time as it is nontrivial and necessarily intrusive. Recent commit 9d573d19547b ("PCI: pciehp: Detect device replacement during system sleep") provokes more frequent occurrence of the deadlock when removing more than one Thunderbolt device during system sleep. The commit sought to detect device replacement, but also triggered on device removal. Differentiating reliably between replacement and removal is impossible because pci_get_dsn() returns 0 both if the device was removed, as well as if it was replaced with one lacking a Device Serial Number. Avoid the more frequent occurrence of the deadlock by checking whether the hotplug port itself was hot-removed. If so, there's no sense in checking whether its child device was replaced. This works because the ->resume_noirq() callback is invoked in top-down order for the entire hierarchy: A parent hotplug port detecting device replacement (or removal) marks all children as removed using pci_dev_set_disconnected() and a child hotplug port can then reliably detect being removed. The Linux kernel CVE team has assigned CVE-2025-37843 to this issue. Affected and fixed versions =========================== Issue introduced in 6.11 with commit 9d573d19547b3fae0c1d4e5fce52bdad3fda3664 and fixed in 6.12.24 with commit e4a1d7defbc2d806540720a5adebe24ec3488683 Issue introduced in 6.11 with commit 9d573d19547b3fae0c1d4e5fce52bdad3fda3664 and fixed in 6.13.12 with commit 0d0bbd01f7c0ac7d1be9f85aaf2cd0baec34655f Issue introduced in 6.11 with commit 9d573d19547b3fae0c1d4e5fce52bdad3fda3664 and fixed in 6.14.3 with commit 7535d10a2c61baeff493300070cf04d9ddda216b Issue introduced in 6.11 with commit 9d573d19547b3fae0c1d4e5fce52bdad3fda3664 and fixed in 6.15-rc1 with commit e3260237aaadc9799107ccb940c6688195c4518d 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-2025-37843 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/pci/hotplug/pciehp_core.c 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/e4a1d7defbc2d806540720a5adebe24ec3488683 https://git.kernel.org/stable/c/0d0bbd01f7c0ac7d1be9f85aaf2cd0baec34655f https://git.kernel.org/stable/c/7535d10a2c61baeff493300070cf04d9ddda216b https://git.kernel.org/stable/c/e3260237aaadc9799107ccb940c6688195c4518d