CVE-2026-139417: platform/x86/amd/pmc: clear devm-managed pointers on remove to prevent stale reuse
In the Linux kernel, the following vulnerability has been resolved:
platform/x86/amd/pmc: clear devm-managed pointers on remove to prevent stale reuse
The driver stores its state in a single file-scope static struct amdpmcdev, which is reused on every bind. Its regbase, smuvirtaddr, stbvirtaddr and fchvirtaddr members are MMIO mappings created with devmioremap().
On unbind the driver core unmaps these mappings, but it does not clear the pointers in the static struct. Since the struct is not freed, the members keep pointing at the now-unmapped addresses.
On the next bind, the probe path re-maps a region only when its pointer is still NULL, so the stale pointer is reused and the following memcpyfromio()/ioread32() touches freed MMIO, causing use-after-unmap crash. Clear these pointers in amdpmcremove() so the next probe re-maps them instead of reusing stale ones.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In the Linux kernel AMD PMC driver, clear regbase, smu_virt_addr, stb_virt_addr, and fch_virt_addr in amd_pmc_remove() so the next probe re-maps them.
Event History
Frequently Asked Questions
When can this issue be triggered?
The stale MMIO pointers are used after the AMD PMC driver is unbound and then bound again. The first removal causes the devm-managed mappings to be unmapped, and a subsequent probe can reuse the retained pointers instead of creating new mappings.
What is the practical impact?
A subsequent driver bind can access freed MMIO mappings through memcpy_fromio() or ioread32(). The described outcome is a use-after-unmap crash.
Is a normal initial driver load affected?
The described stale-pointer condition requires a prior unbind/remove followed by another bind/probe. The issue is not described as occurring on the initial bind, before devm-managed mappings have been removed.
What does the fix change?
The fix clears regbase, smu_virt_addr, stb_virt_addr, and fch_virt_addr in amd_pmc_remove(). This ensures that the next probe remaps those regions rather than reusing addresses that were unmapped during removal.