CVE-2026-139639: serial: 8250_mxpcie: only unregister the ports that were registered
In the Linux kernel, the following vulnerability has been resolved:
serial: 8250mxpcie: only unregister the ports that were registered
When serial8250register8250port() fails the loop stops and the probe keeps the ports registered so far, like pciserialinitports() in 8250pci.c this driver was split from. What the split lost is that function's priv->nr: mxpcie8250remove() walks all numports entries, but the ones the loop never reached keep the zero devmkzalloc() left there, and the one that failed keeps a negative error code.
serial8250unregisterport() checks neither, so removal unregisters line 0 - a port this driver does not own - and indexes serial8250ports[] with a negative line number.
Record how many ports were registered and unregister only those.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
Track how many ports were successfully registered, and unregister only those ports during mxpcie8250_remove().
Event History
Frequently Asked Questions
When can this issue be triggered?
It is triggered when serial8250_register_8250_port() fails while the 8250_mxpcie driver is registering ports. A later device removal can then attempt to unregister ports that were never successfully registered.
What can the faulty removal path do?
It can unregister line 0, which belongs to another port rather than this driver, and can index serial8250_ports[] using a negative line number. The affected path is mxpcie8250_remove().
What is the relevant fix?
The fix records the number of ports that were successfully registered and limits removal to that number. This prevents cleanup of uninitialized entries and the entry containing the registration failure code.