{"id":"CVE-2022-50568","summary":"usb: gadget: f_hid: fix f_hidg lifetime vs cdev","details":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_hid: fix f_hidg lifetime vs cdev\n\nThe embedded struct cdev does not have its lifetime correctly tied to\nthe enclosing struct f_hidg, so there is a use-after-free if /dev/hidgN\nis held open while the gadget is deleted.\n\nThis can readily be replicated with libusbgx's example programs (for\nconciseness - operating directly via configfs is equivalent):\n\n\tgadget-hid\n\texec 3\u003c\u003e /dev/hidg0\n\tgadget-vid-pid-remove\n\texec 3\u003c&-\n\nPull the existing device up in to struct f_hidg and make use of the\ncdev_device_{add,del}() helpers.  This changes the lifetime of the\ndevice object to match struct f_hidg, but note that it is still added\nand deleted at the same time.","modified":"2026-04-02T08:28:38.292862Z","published":"2025-10-22T13:23:25.136Z","related":["SUSE-SU-2025:4111-1","SUSE-SU-2025:4139-1","SUSE-SU-2025:4149-1","SUSE-SU-2025:4320-1"],"database_specific":{"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50568.json","cna_assigner":"Linux"},"references":[{"type":"WEB","url":"https://git.kernel.org/stable/c/1b6a53e447ec3d81623610c8c7ec5082b47dfdce"},{"type":"WEB","url":"https://git.kernel.org/stable/c/1cd7f156f6389918f760687fbbf133c86da93162"},{"type":"WEB","url":"https://git.kernel.org/stable/c/89ff3dfac604614287ad5aad9370c3f984ea3f4b"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9e08b7f5fa00e9d550851352bd0d1ba74ccffef2"},{"type":"WEB","url":"https://git.kernel.org/stable/c/9e4b85d815b14bd4db2deea2a54264a23de8b896"},{"type":"WEB","url":"https://git.kernel.org/stable/c/c78c87c4e389b62f8892af7f59857447aa6d9797"},{"type":"WEB","url":"https://git.kernel.org/stable/c/d3136b79705c2e3bba9c76adc5628af0215d798e"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50568.json"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-50568"},{"type":"PACKAGE","url":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","events":[{"introduced":"71adf118946957839a13aa4d1094183e05c6c094"},{"fixed":"1cd7f156f6389918f760687fbbf133c86da93162"},{"fixed":"c78c87c4e389b62f8892af7f59857447aa6d9797"},{"fixed":"1b6a53e447ec3d81623610c8c7ec5082b47dfdce"},{"fixed":"d3136b79705c2e3bba9c76adc5628af0215d798e"},{"fixed":"9e4b85d815b14bd4db2deea2a54264a23de8b896"},{"fixed":"9e08b7f5fa00e9d550851352bd0d1ba74ccffef2"},{"fixed":"89ff3dfac604614287ad5aad9370c3f984ea3f4b"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50568.json"}},{"package":{"name":"Kernel","ecosystem":"Linux"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"2.6.35"},{"fixed":"4.19.270"}]},{"type":"ECOSYSTEM","events":[{"introduced":"4.20.0"},{"fixed":"5.4.229"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.5.0"},{"fixed":"5.10.163"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.11.0"},{"fixed":"5.15.86"}]},{"type":"ECOSYSTEM","events":[{"introduced":"5.16.0"},{"fixed":"6.0.16"}]},{"type":"ECOSYSTEM","events":[{"introduced":"6.1.0"},{"fixed":"6.1.2"}]}],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2022-50568.json"}}],"schema_version":"1.7.5"}