CVE-2022-50568

usb: gadget: f_hid: fix f_hidg lifetime vs cdev

No CVSS score yet EPSS 0.22%

Published 22 Oct 2025 Updated 11 May 2026 CNA: Linux

Check your servers for CVE-2022-50568

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2022-50568 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

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.

Exploitation

EPSS 0.22%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 13.2% of all scored CVEs. Scores of 1 Dec 2026.

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from 71adf118946957839a13aa4d1094183e05c6c094, before 1cd7f156f6389918f760687fbbf133c86da93162
affected from 71adf118946957839a13aa4d1094183e05c6c094, before c78c87c4e389b62f8892af7f59857447aa6d9797
affected from 71adf118946957839a13aa4d1094183e05c6c094, before 1b6a53e447ec3d81623610c8c7ec5082b47dfdce
affected from 71adf118946957839a13aa4d1094183e05c6c094, before d3136b79705c2e3bba9c76adc5628af0215d798e
affected from 71adf118946957839a13aa4d1094183e05c6c094, before 9e4b85d815b14bd4db2deea2a54264a23de8b896
affected from 71adf118946957839a13aa4d1094183e05c6c094, before 9e08b7f5fa00e9d550851352bd0d1ba74ccffef2
affected from 71adf118946957839a13aa4d1094183e05c6c094, before 89ff3dfac604614287ad5aad9370c3f984ea3f4b
Other versions: unaffected
Linux
affected 2.6.35
unaffected before 2.6.35
unaffected from 4.19.270 up to and including 4.19.*
unaffected from 5.4.229 up to and including 5.4.*
unaffected from 5.10.163 up to and including 5.10.*
unaffected from 5.15.86 up to and including 5.15.*
unaffected from 6.0.16 up to and including 6.0.*
unaffected from 6.1.2 up to and including 6.1.*
unaffected 6.2 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2022-50568 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2022-50568

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2022-50568
trivy image --scanners vuln IMAGE | grep CVE-2022-50568

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2022-50568 of the CVE List (CVE Program), CVE Terms of Use; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.