CVE-2022-50704
Use-After-Free in Linux USB Gadget Config Switch Causes Kernel Panic
Publication date: 2025-12-24
Last updated on: 2025-12-24
Assigner: kernel.org
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| linux | linux_kernel | * |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-UNKNOWN |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability is a use-after-free issue in the Linux kernel's USB gadget subsystem. It occurs during the process of switching USB configurations from rndis to another configuration. If the hardware does not support the pullup callback or encounters a rare fault causing the pullup callback to fail, it can lead to a system panic due to use-after-free. Specifically, when the pullup callback returns an error, the function rndis_close() is called, which triggers the use-after-free problem.
How can this vulnerability impact me? :
This vulnerability can cause a system panic (crash) in the Linux kernel when switching USB configurations under certain hardware conditions. This can lead to denial of service, making the system unstable or unavailable until rebooted or fixed.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
Detection of this vulnerability involves monitoring for system panics or crashes related to USB gadget configuration switches, especially when switching from rndis to other configurations. Specific commands that interact with the USB gadget configfs interface, such as writing "none" to /config/usb_gadget/g1/UDC, removing /config/usb_gadget/g1/configs/b.1/f1, or removing the directory /config/usb_gadget/g1/functions/rndis.gs4, may trigger the issue if the system is vulnerable. Monitoring kernel logs (e.g., using dmesg) for panic messages related to usb_gadget_disconnect or rndis_close functions can also help detect the problem.
What immediate steps should I take to mitigate this vulnerability?
Immediate mitigation steps include avoiding switching USB gadget configurations from rndis to other configurations on affected systems until a patch is applied. If possible, do not unload gadget drivers or perform operations that trigger the pullup callback failure. Applying the official Linux kernel update that fixes the use-after-free during USB config switch is the recommended long-term mitigation.