{"id":"CVE-2022-50568","aliases":["CVE-2022-50568"],"related":[],"kind":"vulnerability","state":"published","title":"usb: gadget: f_hid: fix f_hidg lifetime vs cdev","summary":"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<> /dev/hidg0\n\tgadget-vid-pid-remove\n\texec 3<&-\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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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<> /dev/hidg0\n\tgadget-vid-pid-remove\n\texec 3<&-\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.","source":"cvelist"}],"published":"2025-10-22T13:23:25.136Z","modified":"2026-06-17T05:23:48.470Z","severities":[],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"71adf118946957839a13aa4d1094183e05c6c094","fixed":"1cd7f156f6389918f760687fbbf133c86da93162","status":"affected"},{"type":"git","introduced":"71adf118946957839a13aa4d1094183e05c6c094","fixed":"c78c87c4e389b62f8892af7f59857447aa6d9797","status":"affected"},{"type":"git","introduced":"71adf118946957839a13aa4d1094183e05c6c094","fixed":"1b6a53e447ec3d81623610c8c7ec5082b47dfdce","status":"affected"},{"type":"git","introduced":"71adf118946957839a13aa4d1094183e05c6c094","fixed":"d3136b79705c2e3bba9c76adc5628af0215d798e","status":"affected"},{"type":"git","introduced":"71adf118946957839a13aa4d1094183e05c6c094","fixed":"9e4b85d815b14bd4db2deea2a54264a23de8b896","status":"affected"},{"type":"git","introduced":"71adf118946957839a13aa4d1094183e05c6c094","fixed":"9e08b7f5fa00e9d550851352bd0d1ba74ccffef2","status":"affected"},{"type":"git","introduced":"71adf118946957839a13aa4d1094183e05c6c094","fixed":"89ff3dfac604614287ad5aad9370c3f984ea3f4b","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"2.6.35","status":"affected"},{"type":"semver","introduced":"0","fixed":"2.6.35","status":"unaffected"},{"type":"semver","introduced":"4.19.270","lastAffected":"4.19.*","status":"unaffected"},{"type":"semver","introduced":"5.4.229","lastAffected":"5.4.*","status":"unaffected"},{"type":"semver","introduced":"5.10.163","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.86","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.0.16","lastAffected":"6.0.*","status":"unaffected"},{"type":"semver","introduced":"6.1.2","lastAffected":"6.1.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"6.2","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"}],"references":[{"url":"https://git.kernel.org/stable/c/1cd7f156f6389918f760687fbbf133c86da93162","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/c78c87c4e389b62f8892af7f59857447aa6d9797","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/1b6a53e447ec3d81623610c8c7ec5082b47dfdce","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/d3136b79705c2e3bba9c76adc5628af0215d798e","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/9e4b85d815b14bd4db2deea2a54264a23de8b896","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/9e08b7f5fa00e9d550851352bd0d1ba74ccffef2","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/89ff3dfac604614287ad5aad9370c3f984ea3f4b","tags":[],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2022-50568","url":"https://www.cve.org/CVERecord?id=CVE-2022-50568","licence":"CVE Terms of Use","modified":"2026-05-11T19:21:56.354Z"},{"source":"nvd","name":"NVD","id":"CVE-2022-50568","url":"https://nvd.nist.gov/vuln/detail/CVE-2022-50568","licence":"Public domain","modified":"2026-06-17T05:23:48.470Z"}],"updatedAt":"2026-11-25T22:58:21.276Z","epss":{"score":0.0022,"percentile":0.13297,"date":"2026-12-01T12:00:22.000Z"}}