# CVE-2025-38069: PCI: endpoint: pci-epf-test: Fix double free that causes kernel to oops

- Priority: **Routine**
- Reason: Not severe (CVSS 7.8, local access); no exploitation reported by the 5 checked sources
- Next step: Fix in the normal cadence
- Status: published
- Published: 2025-06-18 · Modified: 2026-10-30
- Aliases: UBUNTU-CVE-2025-38069, DEBIAN-CVE-2025-38069
- Record: https://cvemate.com/vulnerability/CVE-2025-38069 · JSON: https://cvemate.com/vulnerability/CVE-2025-38069/json

## Description

```text
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]
```

## Signals

- CVSS: 7.8 high (v3.1, NVD) CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- EPSS: 0.241%, percentile 16.317%, as of 2026-12-04
- Known exploited (KEV): CISA not listed, ENISA not listed, CIRCL not listed
- Ransomware use: none recorded
- Public exploits: 0

## Affected (first 20 of 150)

- debian linux (Debian): All versions (No fix recorded) \| \< 6.1.192-1 \| \< 6.12.32-1
- ubuntu linux (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-202.212 \| \< 6.8.0-147.147
- ubuntu linux-allwinner-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-1119.126 \| \< 6.8.0-1067.70
- ubuntu linux-aws-5.0 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.11 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.13 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.15 (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-1119.126~20.04.1
- ubuntu linux-aws-5.19 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.3 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.4 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-5.8 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.14 (Ubuntu): \< 6.14.0-1013.13~24.04.1
- ubuntu linux-aws-6.2 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.5 (Ubuntu): All versions (No fix recorded)
- ubuntu linux-aws-6.8 (Ubuntu): All versions (No fix recorded) \| \< 6.8.0-1069.74~22.04.1
- ubuntu linux-aws-fips (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-1119.126+fips1 \| \< 6.8.0-1067.70+fips1
- ubuntu linux-aws-hwe (Ubuntu): All versions (No fix recorded)
- ubuntu linux-azure (Ubuntu): All versions (No fix recorded) \| \< 5.15.0-1125.134 \| \< 6.8.0-1071.79
- ubuntu linux-azure-4.15 (Ubuntu): All versions (No fix recorded)

## References (first 20 of 29)

- <https://git.kernel.org/stable/c/fe2329eff5bee461ebcafadb6ca1df0cbf5945fd>
- <https://git.kernel.org/stable/c/8b83893d1f6c6061a7d58169ecdf9d5ee9f306ee>
- <https://git.kernel.org/stable/c/934e9d137d937706004c325fa1474f9e3f1ba10a>
- <https://ubuntu.com/security/CVE-2025-38069>
- <https://www.cve.org/CVERecord?id=CVE-2025-38069>
- <https://git.kernel.org/linus/934e9d137d937706004c325fa1474f9e3f1ba10a>
- <https://ubuntu.com/security/notices/USN-7769-1>
- <https://ubuntu.com/security/notices/USN-7770-1>
- <https://ubuntu.com/security/notices/USN-7771-1>
- <https://ubuntu.com/security/notices/USN-7769-2>
- <https://ubuntu.com/security/notices/USN-7769-3>
- <https://ubuntu.com/security/notices/USN-7789-1>
- <https://ubuntu.com/security/notices/USN-7789-2>
- <https://ubuntu.com/security/notices/USN-8781-1>
- <https://security-tracker.debian.org/tracker/CVE-2025-38069>
- <https://ubuntu.com/security/notices/USN-8917-1>
- <https://ubuntu.com/security/notices/USN-8918-1>
- <https://git.kernel.org/stable/c/761db4ca3a469f2070757acd4e104dff5125ca99>
- <https://git.kernel.org/stable/c/e2e43854ab72a9d4908ac2bf6087f80aa138a8b5>
- <https://ubuntu.com/security/notices/USN-8962-1>

---

Data as of 2026-12-05T03:10:16.590Z. The priority label is CveMate's own model from public evidence, not an official rating, and it knows nothing about your assets. How labels are decided: https://cvemate.com/faq#priority
