CVE-2022-50568

Linux Kernel - Use-After-Free in USB Gadget HID Function Driver

Title source: llm
STIX 2.1

Description

In the Linux kernel, the following vulnerability has been resolved: usb: gadget: f_hid: fix f_hidg lifetime vs cdev The embedded struct cdev does not have its lifetime correctly tied to the enclosing struct f_hidg, so there is a use-after-free if /dev/hidgN is held open while the gadget is deleted. This can readily be replicated with libusbgx's example programs (for conciseness - operating directly via configfs is equivalent): gadget-hid exec 3<> /dev/hidg0 gadget-vid-pid-remove exec 3<&- Pull the existing device up in to struct f_hidg and make use of the cdev_device_{add,del}() helpers. This changes the lifetime of the device object to match struct f_hidg, but note that it is still added and deleted at the same time.

Scores

EPSS 0.0021
EPSS Percentile 10.7%

Details

Status published
Products (22)
linux/Kernel 2.6.35 - 4.19.270linux
linux/Kernel 4.20.0 - 5.4.229linux
linux/Kernel 5.11.0 - 5.15.86linux
linux/Kernel 5.16.0 - 6.0.16linux
linux/Kernel 5.5.0 - 5.10.163linux
linux/Kernel 6.1.0 - 6.1.2linux
Linux/Linux < 2.6.35
Linux/Linux 2.6.35
Linux/Linux 4.19.270 - 4.19.*
Linux/Linux 5.10.163 - 5.10.*
... and 12 more
Published Oct 22, 2025
Tracked Since Feb 18, 2026