CVE-2026-142984: usb: gadget: u_serial: pin ports while TTYs are installed

Published Dec 3, 2026
·
Updated

In the Linux kernel, the following vulnerability has been resolved:

usb: gadget: userial: pin ports while TTYs are installed

A slab-use-after-free can occur when gserialfreeline() frees struct gsport while it is still reachable through an installed TTY. The port->port.count value tracks successful opens, but it is zero before gsopen() and again after gsclose(), before TTY cleanup has finished. Teardown can therefore free gsport while ttyinitdev() or releasetty() still accesses its ttyport.

Manage gsport lifetime with ttyport references. Take a reference in gsinstall(), drop it in gscleanup(), and move the final free to gsportdestruct(). Unregister the TTY device before dropping the owner reference.

Keep each minor reserved until the old port is destroyed so an installed TTY for one generation cannot overlap a replacement at the same minor. Publish the new port before device registration so the cdev and add uevent never expose a TTY before gsinstall() can pin it. Since commit 8df07fe93573 ("tty: fix saved termios reset race"), userial registration no longer frees saved termios. On registration failure, unpublish the port before dropping its owner reference.

Check in gsopen() that the installed port is still the published generation. Track failures after a successful install so close callbacks issued by the TTY core do not decrement port->port.count for opens that never incremented it.

Affected Software

1 affected component
Linux Linux kernel

Event History

Dec 3, 2026
CVE Published
via MITRE·09:17 AM
Data Sourced
via MITRE·09:17 AM
Description

Frequently Asked Questions

1

Which systems are exposed to this issue?

Systems using the Linux USB gadget serial (u_serial) functionality are exposed when a gadget serial port can be freed while its TTY remains installed. The vulnerable lifetime window exists during port teardown and TTY initialization or cleanup.

2

What sequence triggers the use-after-free?

The port's open count can be zero before gs_open() or after gs_close() even though tty_init_dev() or release_tty() still accesses the associated tty_port. If gserial_free_line() frees the gs_port during that interval, those TTY operations can access freed memory.

3

What does the fix change to prevent recurrence?

The fix pins gs_port with tty_port references while a TTY is installed and performs final freeing in gs_port_destruct(). It also reserves each minor until the old port is destroyed and unregisters the TTY device before dropping the owner's reference.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203