{"id":"CVE-2026-31721","aliases":["CVE-2026-31721"],"related":[],"kind":"vulnerability","state":"published","title":"usb: gadget: f_hid: move list and spinlock inits from bind to alloc","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_hid: move list and spinlock inits from bind to alloc\n\nThere was an issue when you did the following:\n- setup and bind an hid gadget\n- open /dev/hidg0\n- use the resulting fd in EPOLL_CTL_ADD\n- unbind the UDC\n- bind the UDC\n- use the fd in EPOLL_CTL_DEL\n\nWhen CONFIG_DEBUG_LIST was enabled, a list_del corruption was reported\nwithin remove_wait_queue (via ep_remove_wait_queue). After some\ndebugging I found out that the queues, which f_hid registers via\npoll_wait were the problem. These were initialized using\ninit_waitqueue_head inside hidg_bind. So effectively, the bind function\nre-initialized the queues while there were still items in them.\n\nThe solution is to move the initialization from hidg_bind to hidg_alloc\nto extend their lifetimes to the lifetime of the function instance.\n\nAdditionally, I found many other possibly problematic init calls in the\nbind function, which I moved as well.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nusb: gadget: f_hid: move list and spinlock inits from bind to alloc\n\nThere was an issue when you did the following:\n- setup and bind an hid gadget\n- open /dev/hidg0\n- use the resulting fd in EPOLL_CTL_ADD\n- unbind the UDC\n- bind the UDC\n- use the fd in EPOLL_CTL_DEL\n\nWhen CONFIG_DEBUG_LIST was enabled, a list_del corruption was reported\nwithin remove_wait_queue (via ep_remove_wait_queue). After some\ndebugging I found out that the queues, which f_hid registers via\npoll_wait were the problem. These were initialized using\ninit_waitqueue_head inside hidg_bind. So effectively, the bind function\nre-initialized the queues while there were still items in them.\n\nThe solution is to move the initialization from hidg_bind to hidg_alloc\nto extend their lifetimes to the lifetime of the function instance.\n\nAdditionally, I found many other possibly problematic init calls in the\nbind function, which I moved as well.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nusb: gadget: f_hid: mover inicializaciones de lista y spinlock de bind a alloc\n\nHubo un problema cuando se hizo lo siguiente:\n- configurar y enlazar un gadget hid\n- abrir /dev/hidg0\n- usar el fd resultante en EPOLL_CTL_ADD\n- desenlazar el UDC\n- enlazar el UDC\n- usar el fd en EPOLL_CTL_DEL\n\nCuando CONFIG_DEBUG_LIST estaba habilitado, se informó una corrupción de list_del dentro de remove_wait_queue (a través de ep_remove_wait_queue). Después de alguna depuración, descubrí que las colas, que f_hid registra a través de poll_wait, eran el problema. Estas se inicializaban usando init_waitqueue_head dentro de hidg_bind. Así que, efectivamente, la función bind reinicializaba las colas mientras todavía había elementos en ellas.\n\nLa solución es mover la inicialización de hidg_bind a hidg_alloc para extender sus vidas útiles a la vida útil de la instancia de la función.\n\nAdemás, encontré muchas otras llamadas de inicialización posiblemente problemáticas en la función bind, las cuales también moví.","source":"nvd"}],"published":"2026-05-01T14:14:23.492Z","modified":"2026-11-11T21:10:00.200Z","severity":{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"},"severities":[{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H","score":5.5,"rating":"MEDIUM"}],"cwes":[],"affected":[{"ranges":[{"type":"git","introduced":"cb382536052fcc7713988869b54a81137069e5a9","fixed":"13440c0db227c5db01da751ed966dde4cdd2ea18","status":"affected"},{"type":"git","introduced":"cb382536052fcc7713988869b54a81137069e5a9","fixed":"de93e0862169b5539e00c2b9980b93fd80c37c0d","status":"affected"},{"type":"git","introduced":"cb382536052fcc7713988869b54a81137069e5a9","fixed":"81aee4500055876883658b024b6fb61801afe134","status":"affected"},{"type":"git","introduced":"cb382536052fcc7713988869b54a81137069e5a9","fixed":"8ec6a58586f195a88479edcdb0b8027c39f12d03","status":"affected"},{"type":"git","introduced":"cb382536052fcc7713988869b54a81137069e5a9","fixed":"f7d00ee1c8082c8a134340aaf16d71a27e29c362","status":"affected"},{"type":"git","introduced":"cb382536052fcc7713988869b54a81137069e5a9","fixed":"5d1bb391ceeebb28327703dd07af8c6324af298f","status":"affected"},{"type":"git","introduced":"cb382536052fcc7713988869b54a81137069e5a9","fixed":"26a879a41ed960b3fb4ec773ef2788c515c0e488","status":"affected"},{"type":"git","introduced":"cb382536052fcc7713988869b54a81137069e5a9","fixed":"4e0a88254ad59f6c53a34bf5fa241884ec09e8b2","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"3.19","status":"affected"},{"type":"semver","introduced":"0","fixed":"3.19","status":"unaffected"},{"type":"semver","introduced":"5.10.253","lastAffected":"5.10.*","status":"unaffected"},{"type":"semver","introduced":"5.15.203","lastAffected":"5.15.*","status":"unaffected"},{"type":"semver","introduced":"6.1.169","lastAffected":"6.1.*","status":"unaffected"},{"type":"semver","introduced":"6.6.135","lastAffected":"6.6.*","status":"unaffected"},{"type":"semver","introduced":"6.12.81","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.22","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"6.19.12","lastAffected":"6.19.*","status":"unaffected"},{"type":"original_commit_for_fix","introduced":"7.0","lastAffected":"*","status":"unaffected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"status":"affected","introduced":"3.19","fixed":"5.10.253"},{"status":"affected","introduced":"5.11","fixed":"5.15.203"},{"status":"affected","introduced":"5.16","fixed":"6.1.169"},{"status":"affected","introduced":"6.2","fixed":"6.6.135"},{"status":"affected","introduced":"6.7","fixed":"6.12.81"},{"status":"affected","introduced":"6.13","fixed":"6.18.22"},{"status":"affected","introduced":"6.19","fixed":"6.19.12"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"},{"status":"affected","version":"7.0"}],"vendor":"linux","product":"linux_kernel","cpe":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://git.kernel.org/stable/c/13440c0db227c5db01da751ed966dde4cdd2ea18","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/de93e0862169b5539e00c2b9980b93fd80c37c0d","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/81aee4500055876883658b024b6fb61801afe134","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/8ec6a58586f195a88479edcdb0b8027c39f12d03","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/f7d00ee1c8082c8a134340aaf16d71a27e29c362","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/5d1bb391ceeebb28327703dd07af8c6324af298f","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/26a879a41ed960b3fb4ec773ef2788c515c0e488","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/4e0a88254ad59f6c53a34bf5fa241884ec09e8b2","tags":["patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-31721","url":"https://www.cve.org/CVERecord?id=CVE-2026-31721","licence":"CVE Terms of Use","modified":"2026-05-11T22:14:28.436Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-31721","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31721","licence":"Public domain","modified":"2026-11-11T21:10:00.200Z"}],"updatedAt":"2026-11-25T22:59:20.351Z","epss":{"score":0.00132,"percentile":0.02987,"date":"2026-12-01T12:00:22.000Z"}}