# CVE-2026-139460: PCI/P2PDMA: Do not tear down the allocate attribute on registration failure


- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Fix available:** Yes
- **Published:** 30 Nov 2026
- **Updated:** 30 Nov 2026
- **Also known as:** AZL-117157, BELL-CVE-2026-139460, DEBIAN-CVE-2026-139460, GHSA-x3m7-5g97-5667, UBUNTU-CVE-2026-139460

## What is CVE-2026-139460?

CVE-2026-139460 is a vulnerability in Linux, published on 30 Nov 2026. 

### Official description

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

PCI/P2PDMA: Do not tear down the allocate attribute on registration failure

pci_p2pdma_add_resource() installs pci_p2pdma_unmap_mappings() as a devres
action with the devres allocated p2p_pgmap as its data, and only then adds
the range to the pool:

  error = devm_add_action_or_reset(&pdev->dev, pci_p2pdma_unmap_mappings,
                                   p2p_pgmap);
  if (error)
          goto pages_free;

  p2pdma = rcu_dereference_protected(pdev->p2pdma, 1);
  error = gen_pool_add_owner(p2pdma->pool, ...);
  if (error)
          goto pages_free;

The action removes the allocate attribute for the whole device, which tears
down existing userspace mappings of every BAR already registered on it.
Both failures here get that wrong, in opposite ways.

devm_add_action_or_reset() runs the action when it cannot allocate its
devres node, so an -ENOMEM while registering a second BAR unmaps the first
one. Use devm_add_action() and let the error path unwind only what this
call created.

gen_pool_add_owner() allocates a chunk and can also fail with -ENOMEM.
There the action is registered, and the error path frees p2p_pgmap with
devm_kfree() while leaving the action pointing at it. On unbind devres
runs the action and pci_p2pdma_unmap_mappings() dereferences
p2p_pgmap->mem->owner->kobj, which is freed memory. Give that failure its
own label and drop the action with devm_remove_action(), which removes it
without running it.

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


## How do I fix CVE-2026-139460?

Upgrade to a fixed version.

## Is CVE-2026-139460 being exploited?

There is no known exploitation of CVE-2026-139460 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-139460 and fix it if it is affected.

What it is: CVE-2026-139460 is a vulnerability in Linux, published on 30 Nov 2026. 
Exploitation: There is no known exploitation of CVE-2026-139460 in the wild and no public exploit code.

Affected product: Linux. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-139460/ (Markdown: https://insights.sbomify.com/CVE-2026-139460/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-139460
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-139460
- OSV: https://osv.dev/vulnerability/CVE-2026-139460

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-139460/
Summaries are generated and may contain mistakes; the official description above is the record.
