CVE-2022-50704
kernel: USB: gadget: Fix use-after-free during usb config switch
Severity
LowRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · December 24, 2025
Updated · July 22, 2026
Description
A use-after-free vulnerability was found in the Linux kernel's USB gadget subsystem. When switching USB configuration from RNDIS to another configuration, if the hardware's pullup callback fails (either unsupported or hardware fault), the error handling path triggers rndis_close() on already-freed memory. This occurs because the gadget disconnect sequence frees resources that are later accessed during configfs cleanup, causing a system panic.
Statement
This flaw affects systems using USB gadget mode with RNDIS (Remote NDIS) functionality, typically found in embedded Linux devices acting as USB peripherals. The vulnerability requires local access to manipulate configfs entries and trigger a hardware error condition during USB configuration changes. The race between disconnect and cleanup operations makes exploitation timing-dependent.
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
No mitigation is specified in collected source.
CVSS / CWE
CVSS 3.1 · 5.5CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
CWE-825 · Expired Pointer Dereference