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 06D462820C6 for ; Wed, 18 Jun 2025 09:35:39 +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=1750239339; cv=none; b=ajL0NbD1x+ZgZvjpC3pf3LQeSpS6dFvoSkGq1mJirWtUG18Ii8Fk1WYa4EcgaHqQM3sbu8+Leyn4IaG9YuySe0NOvIJ83aPBYnNEZ4I/17LtbqhaqBZn2Vcajz0T22rR1KPSjYs+mYqe1CmRPcSwaDhMoTvQ4oveKUI/n9fIINI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750239339; c=relaxed/simple; bh=drQX8I9OKESmW2y5vE8WVMVUnxQUHijCyl+sGrnbIII=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LslK/0SAeWAweUqpK8MgUoHlioDkj5fk2DL3b/sX8nVg3ATgxkv0so2XFwx8Ukf4Zk9hOn5U/yaTKJP/1Sxndr7I+cEPEZB86kg7GLzLkpj9CV2x/6Mziu8BMkCxMyFTrfQzma0shsIZgJwnW179V6LM1jQggeeg9FzIsUNdBVY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=VPEBpUy9; 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="VPEBpUy9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6891BC4CEE7; Wed, 18 Jun 2025 09:35:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750239338; bh=drQX8I9OKESmW2y5vE8WVMVUnxQUHijCyl+sGrnbIII=; h=From:To:Cc:Subject:Date:Reply-to:From; b=VPEBpUy9jDV5xK0LqfcSbtWYPoto9aHJzZBkkShE9A3D4WEe9RsuMJbpkyPw2NFOS XPcpZH1J6GrPI92ayPkAh28NnryK7yaXUGg6/s07Mt7Uf+gLI0vEY8OTVBbLnHMy8W D7u7+L1a4Na92GMjoYgpM5xW4NTsf8G/R2uvxHQ8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2025-38069: PCI: endpoint: pci-epf-test: Fix double free that causes kernel to oops Date: Wed, 18 Jun 2025 11:34:04 +0200 Message-ID: <2025061838-CVE-2025-38069-b1a0@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=2680; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=xCCm9cAXXqtAfp2gLayf+XCeeW/fRBxLMSwnKZyRmwE=; b=owGbwMvMwCRo6H6F97bub03G02pJDBlB7Z9c43bNS9VM1P8598GUE3PZluWa9Fs7Gd2omsJdn rni6dHVHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRdjuGBZvWb0kqP36qvPBl wKvJZhl8ljukUxjmqei9biszOCYevbPLvGHZ9JsbC9MnAgA= 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: endpoint: pci-epf-test: Fix double free that causes kernel to oops Fix a kernel oops found while testing the stm32_pcie Endpoint driver with handling of PERST# deassertion: During EP initialization, pci_epf_test_alloc_space() allocates all BARs, which are further freed if epc_set_bar() fails (for instance, due to no free inbound window). However, when pci_epc_set_bar() fails, the error path: pci_epc_set_bar() -> pci_epf_free_space() does not clear the previous assignment to epf_test->reg[bar]. Then, if the host reboots, the PERST# deassertion restarts the BAR allocation sequence with the same allocation failure (no free inbound window), creating a double free situation since epf_test->reg[bar] was deallocated and is still non-NULL. Thus, make sure that pci_epf_alloc_space() and pci_epf_free_space() invocations are symmetric, and as such, set epf_test->reg[bar] to NULL when memory is freed. [kwilczynski: commit log] The Linux kernel CVE team has assigned CVE-2025-38069 to this issue. Affected and fixed versions =========================== Fixed in 6.12.31 with commit fe2329eff5bee461ebcafadb6ca1df0cbf5945fd Fixed in 6.14.9 with commit 8b83893d1f6c6061a7d58169ecdf9d5ee9f306ee Fixed in 6.15 with commit 934e9d137d937706004c325fa1474f9e3f1ba10a 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-38069 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/endpoint/functions/pci-epf-test.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/fe2329eff5bee461ebcafadb6ca1df0cbf5945fd https://git.kernel.org/stable/c/8b83893d1f6c6061a7d58169ecdf9d5ee9f306ee https://git.kernel.org/stable/c/934e9d137d937706004c325fa1474f9e3f1ba10a