CVE-2026-138819: serial: 8250_exar: store the GPIO platform device in struct exar8250
In the Linux kernel, the following vulnerability has been resolved:
serial: 8250exar: store the GPIO platform device in struct exar8250
The GPIO platform device is registered via platform->registergpio() when port 0 is being set up. It is stored to port->port.privatedata of the on-stack uart template (and from there it is copied into every registered port). pcixr17v35xexit() then fetches it back by serial8250getport(priv->line[0]).
But port 0 does not have to exist at that point. If serial8250register8250port() fails for port 0, priv->line[0] holds a negative error code. The probe still succeeds (it only breaks the loop), so on unbind, priv->line[0] (a negative value) is passed to serial8250getport(). The GPIO device is never unregistered and a bogus port is accessed.
The same problem would also occur after the planned conversion of serial8250register8250port() to return a uart port instead of a line. As Sashiko pointed out in that case: If board->setup() fails for the first port (i=0) in exarpciprobe(), priv->uport[0] remains NULL. If serial8250register8250port() fails, it returns an ERRPTR. In either case, the loop breaks and probe returns success. When the device is later unbound, pcixr17v35xexit() unconditionally passes priv->uport[0] to platform->unregistergpio(), which will dereference it without checking for validity.
The GPIO device belongs to the PCI device, not to any particular port. So store it in a new struct exar8250::gpio member. Pass priv to both ->registergpio() and ->unregistergpio(), so that pcixr17v35xexit() does not need to look up any port at all.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.10.275 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.226 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.63 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.4 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.4-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1Fixed in 7.3.4-1
Event History
Frequently Asked Questions
Which systems are exposed to the faulty cleanup path?
Systems using the Linux kernel's 8250_exar serial driver are exposed when setup or registration of the first serial port fails, but the driver probe still succeeds. The issue is triggered later when the device is unbound.
What indicates that this condition has occurred?
A failure to register port 0 can leave its recorded line value negative while probe succeeds. During unbind, the driver may use that invalid value to access a bogus serial port, and the GPIO platform device may remain registered instead of being unregistered.