# CVE-2022-50568: usb: gadget: f_hid: fix f_hidg lifetime vs cdev

- Severity: not scored yet
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.22%, higher than 13% of CVEs (2026-12-01)
- Published: 2025-10-22T13:23:25.136Z
- Modified: 2026-06-17T05:23:48.470Z
- Assigned by: Linux

## 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.

(As written by CVE List.)

## Affected

- Linux Linux: from 71adf118946957839a13aa4d1094183e05c6c094 before 1cd7f156f6389918f760687fbbf133c86da93162; from 71adf118946957839a13aa4d1094183e05c6c094 before c78c87c4e389b62f8892af7f59857447aa6d9797; from 71adf118946957839a13aa4d1094183e05c6c094 before 1b6a53e447ec3d81623610c8c7ec5082b47dfdce; from 71adf118946957839a13aa4d1094183e05c6c094 before d3136b79705c2e3bba9c76adc5628af0215d798e; from 71adf118946957839a13aa4d1094183e05c6c094 before 9e4b85d815b14bd4db2deea2a54264a23de8b896; from 71adf118946957839a13aa4d1094183e05c6c094 before 9e08b7f5fa00e9d550851352bd0d1ba74ccffef2; from 71adf118946957839a13aa4d1094183e05c6c094 before 89ff3dfac604614287ad5aad9370c3f984ea3f4b; 2.6.35 (not affected: before 2.6.35; from 4.19.270 up to 4.19.*; from 5.4.229 up to 5.4.*; from 5.10.163 up to 5.10.*; from 5.15.86 up to 5.15.*; from 6.0.16 up to 6.0.*; from 6.1.2 up to 6.1.*; from 6.2 up to *)

## References

- <https://git.kernel.org/stable/c/1cd7f156f6389918f760687fbbf133c86da93162>
- <https://git.kernel.org/stable/c/c78c87c4e389b62f8892af7f59857447aa6d9797>
- <https://git.kernel.org/stable/c/1b6a53e447ec3d81623610c8c7ec5082b47dfdce>
- <https://git.kernel.org/stable/c/d3136b79705c2e3bba9c76adc5628af0215d798e>
- <https://git.kernel.org/stable/c/9e4b85d815b14bd4db2deea2a54264a23de8b896>
- <https://git.kernel.org/stable/c/9e08b7f5fa00e9d550851352bd0d1ba74ccffef2>
- <https://git.kernel.org/stable/c/89ff3dfac604614287ad5aad9370c3f984ea3f4b>

## Sources

- CVE List: [CVE-2022-50568](https://www.cve.org/CVERecord?id=CVE-2022-50568), CVE Terms of Use, modified 2026-05-11
- NVD: [CVE-2022-50568](https://nvd.nist.gov/vuln/detail/CVE-2022-50568), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2022-50568 · Whole record: https://cve.day/CVE-2022-50568.json · Rebuilt by cve.day 2026-11-25T22:58:21.276Z
