0.0
NA
CVE-2022-50568
usb: gadget: f_hid: fix f_hidg lifetime vs cdev
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.

INFO

Published Date :

Oct. 22, 2025, 2:15 p.m.

Last Modified :

Oct. 22, 2025, 9:12 p.m.

Remotely Exploit :

No

Source :

416baaa9-dc9f-4396-8d5f-8c081fb06d67
Affected Products

The following products are affected by CVE-2022-50568 vulnerability. Even if cvefeed.io is aware of the exact versions of the products that are affected, the information is not represented in the table below.

ID Vendor Product Action
1 Linux linux_kernel
Solution
Fix lifetime management of struct f_hidg to prevent use-after-free errors.
  • Update the Linux kernel to incorporate the f_hidg lifetime fix.
  • Ensure device object lifetime matches struct f_hidg.
  • Use cdev_device_add() and cdev_device_del() helpers.
CWE - Common Weakness Enumeration

While CVE identifies specific instances of vulnerabilities, CWE categorizes the common flaws or weaknesses that can lead to vulnerabilities. CVE-2022-50568 is associated with the following CWEs:

Common Attack Pattern Enumeration and Classification (CAPEC)

Common Attack Pattern Enumeration and Classification (CAPEC) stores attack patterns, which are descriptions of the common attributes and approaches employed by adversaries to exploit the CVE-2022-50568 weaknesses.

We scan GitHub repositories to detect new proof-of-concept exploits. Following list is a collection of public exploits and proof-of-concepts, which have been published on GitHub (sorted by the most recently updated).

Results are limited to the first 15 repositories due to potential performance issues.

The following list is the news that have been mention CVE-2022-50568 vulnerability anywhere in the article.

The following table lists the changes that have been made to the CVE-2022-50568 vulnerability over time.

Vulnerability history details can be useful for understanding the evolution of a vulnerability, and for identifying the most recent changes that may impact the vulnerability's severity, exploitability, or other characteristics.

  • New CVE Received by 416baaa9-dc9f-4396-8d5f-8c081fb06d67

    Oct. 22, 2025

    Action Type Old Value New Value
    Added 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.
    Added Reference https://git.kernel.org/stable/c/1b6a53e447ec3d81623610c8c7ec5082b47dfdce
    Added Reference https://git.kernel.org/stable/c/1cd7f156f6389918f760687fbbf133c86da93162
    Added Reference https://git.kernel.org/stable/c/89ff3dfac604614287ad5aad9370c3f984ea3f4b
    Added Reference https://git.kernel.org/stable/c/9e08b7f5fa00e9d550851352bd0d1ba74ccffef2
    Added Reference https://git.kernel.org/stable/c/9e4b85d815b14bd4db2deea2a54264a23de8b896
    Added Reference https://git.kernel.org/stable/c/c78c87c4e389b62f8892af7f59857447aa6d9797
    Added Reference https://git.kernel.org/stable/c/d3136b79705c2e3bba9c76adc5628af0215d798e
EPSS is a daily estimate of the probability of exploitation activity being observed over the next 30 days. Following chart shows the EPSS score history of the vulnerability.
Vulnerability Scoring Details
No CVSS metrics available for this vulnerability.