CVE-2026-139460

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

Published Nov 30, 2026 CVSS 3.1 · 4.1 Medium EPSS n/a KEV · Not listed
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.

Analysis

AI-generated

Technical impact

The vulnerability arises from incorrect handling of device resource cleanup during PCI P2PDMA register operations in the Linux kernel. If the kernel fails to register a second Base Address Register (BAR) or cannot allocate memory for a P2PDMA pool, the cleanup actions can mistakenly unmap or prematurely free resources that are still in use. The resulting dereference of freed memory can cause an invalid pointer access that crashes the kernel, leading to a denial of service. This flaw involves a use‑after‑free or dereference of freed memory weakness, which can be exploited once the vulnerable code path is reachable.

Affected Systems

All Linux kernel implementations are potentially affected, as the issue is present in the generic Linux kernel codebase. No specific version range is provided; any kernel in use prior to the patch may be susceptible. The product is the Linux kernel, managed by the Linux community.

Risk and Exploitability

The CVSS score is not stated, and the EPSS score is not available, so the quantitative risk assessment is incomplete. The vulnerability is listed as not part of the CISA KEV catalog, indicating no known public exploits. Exploitation requires the ability to load kernel modules or register PCI devices with PRR capabilities, typically achieved by a privileged user. An attacker who can execute code in the kernel context can trigger the faulty cleanup path, leading to a kernel panic. The risk is significant due to the potential for system-wide denial of service, but practical exploitation may be limited to environments where a privileged user can load the affected driver or interact with the vulnerable device.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the Linux kernel to the latest release that contains the PCI P2PDMA cleanup fix
  • If immediate kernel upgrade is not possible, disable or unload the PCI P2PDMA driver, or blacklist the module so that devices triggering the bug are not loaded
  • Enforce kernel module signing and implement a strict module‑load policy to prevent unauthorized modules from being loaded, thereby limiting the likelihood that an attacker can exercise the vulnerability

Generated by OpenCVE AI on December 1, 2026 at 05:37 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-825
References
Metrics threat_severity

None

cvssV3_1

{'score': 4.1, 'vector': 'CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:N/I:N/A:H'}

threat_severity

Moderate

Type Values Removed Values Added
Weaknesses CWE-416
Type Values Removed Values Added
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.
Title PCI/P2PDMA: Do not tear down the allocate attribute on registration failure
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:34 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:19 PM
Modified
Nov 30, 2026, 2:19 PM
Severity
Moderate
Public date
Nov 30, 2026, 1:34 PM