AZL-117157: CVE-2026-139460 affecting package kernel 6.6.161.1-1
In the Linux kernel, the following vulnerability has been resolved:
PCI/P2PDMA: Do not tear down the allocate attribute on registration failure
pcip2pdmaaddresource() installs pcip2pdmaunmapmappings() as a devres action with the devres allocated p2ppgmap as its data, and only then adds the range to the pool:
error = devmaddactionorreset(&pdev->dev, pcip2pdmaunmapmappings, p2ppgmap); if (error) goto pagesfree;
p2pdma = rcudereferenceprotected(pdev->p2pdma, 1); error = genpooladdowner(p2pdma->pool, ...); if (error) goto pagesfree;
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.
devmaddactionorreset() runs the action when it cannot allocate its devres node, so an -ENOMEM while registering a second BAR unmaps the first one. Use devmaddaction() and let the error path unwind only what this call created.
genpooladdowner() allocates a chunk and can also fail with -ENOMEM. There the action is registered, and the error path frees p2ppgmap with devmkfree() while leaving the action pointing at it. On unbind devres runs the action and pcip2pdmaunmapmappings() dereferences p2ppgmap->mem->owner->kobj, which is freed memory. Give that failure its own label and drop the action with devmremoveaction(), which removes it without running it.
Affected Software
Event History
Frequently Asked Questions
What conditions must be present for this issue to be triggered?
The issue occurs when registering PCI P2PDMA resources and either devres action allocation or gen_pool_add_owner() fails, including due to -ENOMEM. The described failure cases involve registration of a BAR, including registration of a second BAR when another BAR is already registered.
What is the practical impact of a failed registration?
An -ENOMEM while registering a second BAR can remove the allocate attribute and unmap existing userspace mappings for BARs already registered on the device. If gen_pool_add_owner() fails, a cleanup action can retain a pointer to freed memory and later be invoked during device unbind.
How can administrators recognize that they may be affected?
Look for failures while registering PCI P2PDMA BAR resources, particularly -ENOMEM errors from devres action setup or gen_pool_add_owner(). Systems with existing userspace mappings of previously registered BARs may observe those mappings being torn down after a later BAR registration failure.