CVE-2026-143121: power: sequencing: pcie-m2: fix use-after-free in pwrseq_pcie_m2_vregs_enable()
In the Linux kernel, the following vulnerability has been resolved:
power: sequencing: pcie-m2: fix use-after-free in pwrseqpciem2vregsenable()
During device teardown or on the probe error path, a concurrent consumer access triggers a use-after-free in pwrseqpciem2vregsenable() or pwrseqpciem2vregsdisable() due to a lifetime inversion between devm-managed device registration and manual resource cleanup.
The driver exposes the power sequencer using devmpwrseqdeviceregister(), meaning the device remains fully registered and accessible on the pwrseqbus until the driver core schedules devmpwrseqdeviceunregister() to run after pwrseqpciem2remove() returns. However, the driver performs manual resource teardown within pwrseqpciem2remove() and the pwrseqpciem2probe() error path, prematurely destroying the backing regulator array.
This creates a narrow vulnerability window where the globally visible power sequencer is backed by freed memory. If a concurrent consumer invokes pwrseqenable() during this window, execution is routed to the sequencer callback and dereferences the destroyed ctx->regs array, resulting in a direct use-after-free and a kernel crash.
Schedule a devres action for freeing the memory used for the regulator array to ensure it runs after the pwrseq provider was unregistered.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Schedule a devres action to free the regulator array only after the pwrseq provider has been unregistered.