CVE-2026-31723
Use-After-Free in Linux Kernel USB Gadget Subsystem
Publication date: 2026-05-01
Last updated on: 2026-05-07
Assigner: kernel.org
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | 7.0 |
| linux | linux_kernel | From 6.13 (inc) to 6.18.22 (exc) |
| linux | linux_kernel | From 6.19 (inc) to 6.19.12 (exc) |
| linux | linux_kernel | From 3.11 (inc) to 6.12.81 (exc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-UNKNOWN |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability in the Linux kernel relates to the lifecycle management of the net_device object within the USB gadget subsystem, specifically the f_subset function.
The net_device is created and registered with the gadget device as its sysfs parent during the bind phase. However, when the function unbinds, the parent gadget device is destroyed but the net_device remains, causing dangling symbolic links in sysfs.
The fix involves using device_move() to properly reparent the net_device between the gadget device tree and the virtual device tree during bind and unbind cycles. This ensures that during unbind, the net_device is moved to the virtual device tree before the gadget device is destroyed, preventing dangling links and maintaining correct sysfs topology and power management ordering.
Additionally, a bound flag is used to maintain compatibility with legacy composite drivers by indicating whether the network device is shared and pre-registered.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The provided information about the vulnerability in the Linux kernel's usb gadget subsystem does not include any details regarding its impact on compliance with common standards and regulations such as GDPR or HIPAA.
How can this vulnerability impact me? :
This vulnerability can lead to dangling sysfs symbolic links for network devices after the USB gadget function unbinds. These dangling links may cause confusion or errors in system management tools or scripts that rely on sysfs for device information.
Improper device lifecycle management could potentially affect power management ordering and system stability related to USB network devices.
However, there is no indication from the provided information that this vulnerability leads to privilege escalation, data leakage, or direct security compromise.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability can be detected by checking for dangling sysfs symlinks related to the net_device associated with USB gadget functions. Specifically, you can look for network devices under /sys/class/net that point to non-existent paths in the gadget device tree.
- Run the command: ls -l /sys/class/net/usb0
- Then check the target of the symlink with: ls -l /sys/devices/platform/.../gadget.0/net/usb0
If the second command returns 'No such file or directory', it indicates a dangling symlink caused by the net_device surviving after the parent gadget device is destroyed, which is the core issue of this vulnerability.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, ensure that the Linux kernel version you are using includes the fix that properly manages the net_device lifecycle with device_move().
This fix involves using device_move() to reparent the net_device between the gadget device tree and the virtual device tree during bind and unbind cycles, preventing dangling sysfs symlinks.
If you are using legacy composite drivers, verify that the bound flag is correctly used to indicate shared and pre-registered network devices during the bind phase.
In practice, this means updating your kernel to a version that includes this patch or applying the patch manually if possible.