CVE-2026-31578: media: as102: fix to not free memory after the device is registered in as102_usb_probe()
In the Linux kernel, the following vulnerability has been resolved:
media: as102: fix to not free memory after the device is registered in as102usbprobe()
In as102usb driver, the following race condition occurs: CPU0 CPU1 as102usbprobe() kzalloc(); // alloc as102devt .... usbregisterdev(); fd = sysopen("/path/to/dev"); // open as102 fd .... usbderegisterdev(); .... kfree(); // free as102devt .... sysclose(fd); as102release() // UAF!! as102usbrelease() kfree(); // DFB!!
When a USB character device registered with usbregisterdev() is later unregistered (via usbderegisterdev() or disconnect), the device node is removed so new open() calls fail. However, file descriptors that are already open do not go away immediately: they remain valid until the last reference is dropped and the driver's .release() is invoked.
In as102, as102usbprobe() calls usbregisterdev() and then, on an error path, does usbderegisterdev() and frees as102devt right away. If userspace raced a successful open() before the deregistration, that open FD will later hit as102release() --> as102usbrelease() and access or free as102devt again, occur a race to use-after-free and double-free vuln.
The fix is to never kfree(as102devt) directly once usbregisterdev() has succeeded. After deregistration, defer freeing memory to .release().
In other words, let release() perform the last kfree when the final open FD is closed.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Do not call kfree(as102_dev_t) directly once usb_register_dev() has succeeded in as102_usb_probe(). If usb_deregister_dev() is invoked or disconnect occurs after registration, defer freeing the as102_dev_t instance and ensure the driver's .release() (as102_release / as102_usb_release) performs the final kfree when the last open file descriptor is closed.
Linux kernel as102 driver (as102_usb_probe / as102_release) free_on_deregister = false
Event History
Frequently Asked Questions
What is the severity of CVE-2026-31578?
CVE-2026-31578 is considered to have a moderate severity level due to the potential for memory corruption.
How do I fix CVE-2026-31578?
To fix CVE-2026-31578, update the Linux kernel to a version that includes the patch addressing this vulnerability.
What systems are affected by CVE-2026-31578?
CVE-2026-31578 affects Linux kernel versions 6.6.136 and earlier, specifically within the as102 USB driver.
What is the impact of CVE-2026-31578?
The impact of CVE-2026-31578 includes potential system instability or crashes due to race conditions linked to the as102_usb_probe function.
Who does CVE-2026-31578 affect?
CVE-2026-31578 primarily affects users and systems utilizing the as102 USB driver within specific Linux kernel versions.