# CVE-2026-31530: cxl/port: Fix use after free of parent\_port in cxl\_detach\_ep()

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.18% (percentile 4, 2026-11-28)
- **CWE:** CWE-416
- **Published:** 2026-04-22T13:54:42.563Z
- **Modified:** 2026-11-11T23:10:00.263Z

## Who should check

- Anyone running Linux \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< b1f62588ab1be6c9535d74348003c86b47ec4abd; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< d216a4bd138eb57cc4ae7c43b2f709e3482af7e2; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< 2c32141462045cf93d54a5146a0ba572b83533dd; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< f7dc6f381a1e5f068333f1faa9265d6af1df4235; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< 19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4
- Anyone running Linux 6.3

## Description

In the Linux kernel, the following vulnerability has been resolved:

cxl/port: Fix use after free of parent\_port in cxl\_detach\_ep()

cxl\_detach\_ep() is called during bottom-up removal when all CXL memory
devices beneath a switch port have been removed. For each port in the
hierarchy it locks both the port and its parent, removes the endpoint,
and if the port is now empty, marks it dead and unregisters the port
by calling delete\_switch\_port(). There are two places during this work
where the parent\_port may be used after freeing:

First, a concurrent detach may have already processed a port by the
time a second worker finds it via bus\_find\_device(). Without pinning
parent\_port, it may already be freed when we discover port-\>dead and
attempt to unlock the parent\_port. In a production kernel that's a
silent memory corruption, with lock debug, it looks like this:

\[\]DEBUG\_LOCKS\_WARN\_ON(\_\_owner\_task(owner) != get\_current())
\[\]WARNING: kernel/locking/mutex.c:949 at \_\_mutex\_unlock\_slowpath+0x1ee/0x310
\[\]Call Trace:
\[\]mutex\_unlock+0xd/0x20
\[\]cxl\_detach\_ep+0x180/0x400 \[cxl\_core\]
\[\]devm\_action\_release+0x10/0x20
\[\]devres\_release\_all+0xa8/0xe0
\[\]device\_unbind\_cleanup+0xd/0xa0
\[\]really\_probe+0x1a6/0x3e0

Second, delete\_switch\_port() releases three devm actions registered
against parent\_port. The last of those is unregister\_port() and it
calls device\_unregister() on the child port, which can cascade. If
parent\_port is now also empty the device core may unregister and free
it too. So by the time delete\_switch\_port() returns, parent\_port may
be free, and the subsequent device\_unlock(&parent\_port-\>dev) operates
on freed memory. The kernel log looks same as above, with a different
offset in cxl\_detach\_ep().

Both of these issues stem from the absence of a lifetime guarantee
between a child port and its parent port.

Establish a lifetime rule for ports: child ports hold a reference to
their parent device until release. Take the reference when the port
is allocated and drop it when released. This ensures the parent is
valid for the full lifetime of the child and eliminates the use after
free window in cxl\_detach\_ep().

This is easily reproduced with a reload of cxl\_acpi in QEMU with CXL
devices present.

## Affected and fixed versions

- Linux: \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< b1f62588ab1be6c9535d74348003c86b47ec4abd; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< d216a4bd138eb57cc4ae7c43b2f709e3482af7e2; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< 2c32141462045cf93d54a5146a0ba572b83533dd; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< f7dc6f381a1e5f068333f1faa9265d6af1df4235; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< 19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4 (cvelist)
- Linux: 6.3 (cvelist)

## Mitigation

- Upgrade Linux to 19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-31530. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-31530.md
Affected: Linux >= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, < b1f62588ab1be6c9535d74348003c86b47ec4abd; >= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, < d216a4bd138eb57cc4ae7c43b2f709e3482af7e2; >= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, < 2c32141462045cf93d54a5146a0ba572b83533dd; >= 2345df54249c6fb7779e2a7…
Fixed in: Linux 2c32141462045cf93d54a5146a0ba572b83533dd, Linux 19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-31530 being exploited?

There is no confirmed exploitation: CVE-2026-31530 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.18% chance of exploitation in the next 30 days (as of 2026-11-28).

### How serious is CVE-2026-31530?

High: CVSS 7.8 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2026-31530?

Linux \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< b1f62588ab1be6c9535d74348003c86b47ec4abd; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< d216a4bd138eb57cc4ae7c43b2f709e3482af7e2; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< 2c32141462045cf93d54a5146a0ba572b83533dd; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< f7dc6f381a1e5f068333f1faa9265d6af1df4235; \>= 2345df54249c6fb7779e2a72b427ee79ed3eaad5, \< 19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4; Linux 6.3.

### Is there a fix for CVE-2026-31530?

Yes. Fixed in Linux 2c32141462045cf93d54a5146a0ba572b83533dd, Linux 19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4. Upgrade Linux to 19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4 or later.

### How do I check if I'm affected by CVE-2026-31530?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/d216a4bd138eb57cc4ae7c43b2f709e3482af7e2>
- patch: <https://git.kernel.org/stable/c/2c32141462045cf93d54a5146a0ba572b83533dd>
- patch: <https://git.kernel.org/stable/c/f7dc6f381a1e5f068333f1faa9265d6af1df4235>
- patch: <https://git.kernel.org/stable/c/19d2f0b97a131198efc2c4ca3eb7f980bba8c2b4>
- other: <https://git.kernel.org/stable/c/b1f62588ab1be6c9535d74348003c86b47ec4abd>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-31530>

HTML: <https://flawdb.com/CVE-2026-31530> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-31530>
