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

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.21%, higher than 11% of CVEs (2026-12-01)
- Published: 2026-11-30T13:34:57.583Z
- Modified: 2026-11-30T14:19:17.263Z
- Assigned by: Linux

## 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.

(As written by CVE List.)

## Affected

- Linux Linux: from 7e9c7ef83d785236f5a8c3761dd053fae9b92fb8 before ea24957f8be21b0724fcb968b73860257b718b63; from 7e9c7ef83d785236f5a8c3761dd053fae9b92fb8 before 4fea96c997265874cfa1788494f9ce2d413b6d92; from 7e9c7ef83d785236f5a8c3761dd053fae9b92fb8 before 29a3a087228b372b9e7ebaf363550e4a1c95ba61; from 7e9c7ef83d785236f5a8c3761dd053fae9b92fb8 before 7c4d6505a1f8a1ebe8019b7f988ed494b696653b; 6.2 (not affected: before 6.2; from 6.12.120 up to 6.12.*; from 6.18.65 up to 6.18.*; from 7.3.6 up to 7.3.*; from 7.4-rc1 up to *)

## References

- <https://git.kernel.org/stable/c/ea24957f8be21b0724fcb968b73860257b718b63>
- <https://git.kernel.org/stable/c/4fea96c997265874cfa1788494f9ce2d413b6d92>
- <https://git.kernel.org/stable/c/29a3a087228b372b9e7ebaf363550e4a1c95ba61>
- <https://git.kernel.org/stable/c/7c4d6505a1f8a1ebe8019b7f988ed494b696653b>

## Sources

- CVE List: [CVE-2026-139460](https://www.cve.org/CVERecord?id=CVE-2026-139460), CVE Terms of Use, modified 2026-11-30
- NVD: [CVE-2026-139460](https://nvd.nist.gov/vuln/detail/CVE-2026-139460), Public domain, modified 2026-11-30

---

Page: https://cve.day/CVE-2026-139460 · Whole record: https://cve.day/CVE-2026-139460.json · Rebuilt by cve.day 2026-11-30T14:33:03.613Z
