CVE-2022-50568

usb: gadget: f_hid: fix f_hidg lifetime vs cdev

N/A
Published: October 22, 2025 at 01:23 PM UTC
Updated: June 17, 2026 at 05:23 AM UTC
1 product affected across 1 vendorLinux Kernel

Using Linux by Linux?

Get instant alerts when new vulnerabilities affect Linux - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
N/A
Exploit prediction
EPSS 0.2%

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.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

2.6.35 ≤ v < 4.19.2702.6.35 ≤ v < 5.10.1632.6.35 ≤ v < 5.15.862.6.35 ≤ v < 5.4.2292.6.35 ≤ v < 6.0.162.6.35 ≤ v < 6.1.22.6.35 ≤ v < 6.22.6.3571adf118946957839a13aa4d1094183e05c6c094
Vendor states this is fixed in 1b6a53e447ec3d81623610c8c7ec5082b47dfdce (fixed)
Vendor states this is fixed in 1cd7f156f6389918f760687fbbf133c86da93162 (fixed)
Vendor states this is fixed in 89ff3dfac604614287ad5aad9370c3f984ea3f4b (fixed)
Vendor states this is fixed in 9e08b7f5fa00e9d550851352bd0d1ba74ccffef2 (fixed)
Vendor states this is fixed in 9e4b85d815b14bd4db2deea2a54264a23de8b896 (fixed)
Vendor states this is fixed in c78c87c4e389b62f8892af7f59857447aa6d9797 (fixed)
Vendor states this is fixed in d3136b79705c2e3bba9c76adc5628af0215d798e (fixed)
Vendor states this is fixed in 2.6.35 (unaffected)
Vendor states this is fixed in 4.19.270 (unaffected)
Vendor states this is fixed in 5.10.163 (unaffected)
Vendor states this is fixed in 5.15.86 (unaffected)
Vendor states this is fixed in 5.4.229 (unaffected)
Vendor states this is fixed in 6.0.16 (unaffected)
Vendor states this is fixed in 6.1.2 (unaffected)
Vendor states this is fixed in 6.2 (unaffected)

Remediation

No guide yet

No remediation guidance has been written for this CVE yet, and no fixed version or vendor advisory is recorded against it.

Quick Info

StatusDEFERRED

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card