{"id":"CVE-2026-31667","aliases":["CVE-2026-31667"],"related":[],"kind":"vulnerability","state":"published","title":"Input: uinput - fix circular locking dependency with ff-core","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\nInput: uinput - fix circular locking dependency with ff-core\n\nA lockdep circular locking dependency warning can be triggered\nreproducibly when using a force-feedback gamepad with uinput (for\nexample, playing ELDEN RING under Wine with a Flydigi Vader 5\ncontroller):\n\n  ff->mutex -> udev->mutex -> input_mutex -> dev->mutex -> ff->mutex\n\nThe cycle is caused by four lock acquisition paths:\n\n1. ff upload: input_ff_upload() holds ff->mutex and calls\n   uinput_dev_upload_effect() -> uinput_request_submit() ->\n   uinput_request_send(), which acquires udev->mutex.\n\n2. device create: uinput_ioctl_handler() holds udev->mutex and calls\n   uinput_create_device() -> input_register_device(), which acquires\n   input_mutex.\n\n3. device register: input_register_device() holds input_mutex and\n   calls kbd_connect() -> input_register_handle(), which acquires\n   dev->mutex.\n\n4. evdev release: evdev_release() calls input_flush_device() under\n   dev->mutex, which calls input_ff_flush() acquiring ff->mutex.\n\nFix this by introducing a new state_lock spinlock to protect\nudev->state and udev->dev access in uinput_request_send() instead of\nacquiring udev->mutex.  The function only needs to atomically check\ndevice state and queue an input event into the ring buffer via\nuinput_dev_event() -- both operations are safe under a spinlock\n(ktime_get_ts64() and wake_up_interruptible() do not sleep).  This\nbreaks the ff->mutex -> udev->mutex link since a spinlock is a leaf in\nthe lock ordering and cannot form cycles with mutexes.\n\nTo keep state transitions visible to uinput_request_send(), protect\nwrites to udev->state in uinput_create_device() and\nuinput_destroy_device() with the same state_lock spinlock.\n\nAdditionally, move init_completion(&request->done) from\nuinput_request_send() to uinput_request_submit() before\nuinput_request_reserve_slot().  Once the slot is allocated,\nuinput_flush_requests() may call complete() on it at any time from\nthe destroy path, so the completion must be initialised before the\nrequest becomes visible.\n\nLock ordering after the fix:\n\n  ff->mutex -> state_lock (spinlock, leaf)\n  udev->mutex -> state_lock (spinlock, leaf)\n  udev->mutex -> input_mutex -> dev->mutex -> ff->mutex (no back-edge)","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\nInput: uinput - fix circular locking dependency with ff-core\n\nA lockdep circular locking dependency warning can be triggered\nreproducibly when using a force-feedback gamepad with uinput (for\nexample, playing ELDEN RING under Wine with a Flydigi Vader 5\ncontroller):\n\n  ff->mutex -> udev->mutex -> input_mutex -> dev->mutex -> ff->mutex\n\nThe cycle is caused by four lock acquisition paths:\n\n1. ff upload: input_ff_upload() holds ff->mutex and calls\n   uinput_dev_upload_effect() -> uinput_request_submit() ->\n   uinput_request_send(), which acquires udev->mutex.\n\n2. device create: uinput_ioctl_handler() holds udev->mutex and calls\n   uinput_create_device() -> input_register_device(), which acquires\n   input_mutex.\n\n3. device register: input_register_device() holds input_mutex and\n   calls kbd_connect() -> input_register_handle(), which acquires\n   dev->mutex.\n\n4. evdev release: evdev_release() calls input_flush_device() under\n   dev->mutex, which calls input_ff_flush() acquiring ff->mutex.\n\nFix this by introducing a new state_lock spinlock to protect\nudev->state and udev->dev access in uinput_request_send() instead of\nacquiring udev->mutex.  The function only needs to atomically check\ndevice state and queue an input event into the ring buffer via\nuinput_dev_event() -- both operations are safe under a spinlock\n(ktime_get_ts64() and wake_up_interruptible() do not sleep).  This\nbreaks the ff->mutex -> udev->mutex link since a spinlock is a leaf in\nthe lock ordering and cannot form cycles with mutexes.\n\nTo keep state transitions visible to uinput_request_send(), protect\nwrites to udev->state in uinput_create_device() and\nuinput_destroy_device() with the same state_lock spinlock.\n\nAdditionally, move init_completion(&request->done) from\nuinput_request_send() to uinput_request_submit() before\nuinput_request_reserve_slot().  Once the slot is allocated,\nuinput_flush_requests() may call complete() on it at any time from\nthe destroy path, so the completion must be initialised before the\nrequest becomes visible.\n\nLock ordering after the fix:\n\n  ff->mutex -> state_lock (spinlock, leaf)\n  udev->mutex -> state_lock (spinlock, leaf)\n  udev->mutex -> input_mutex -> dev->mutex -> ff->mutex (no back-edge)","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\nEntrada: uinput - corrige la dependencia de bloqueo circular con ff-core\n\nUna advertencia de dependencia de bloqueo circular de lockdep puede ser activada de forma reproducible al usar un gamepad con retroalimentación de fuerza con uinput (por ejemplo, jugando ELDEN RING bajo Wine con un controlador Flydigi Vader 5):\n\nff  ->  mutex   ->   udev  ->  mutex   ->   input_mutex   ->   dev  ->  mutex   ->   ff  ->  mutex\n\nEl ciclo es causado por cuatro rutas de adquisición de bloqueo:\n\n1. Carga de ff: input_ff_upload() mantiene ff  ->  mutex y llama a uinput_dev_upload_effect()   ->   uinput_request_submit()   ->   uinput_request_send(), que adquiere udev  ->  mutex.\n\n2. Creación de dispositivo: uinput_ioctl_handler() mantiene udev  ->  mutex y llama a uinput_create_device()   ->   input_register_device(), que adquiere input_mutex.\n\n3. Registro de dispositivo: input_register_device() mantiene input_mutex y llama a kbd_connect()   ->   input_register_handle(), que adquiere dev  ->  mutex.\n\n4. Liberación de evdev: evdev_release() llama a input_flush_device() bajo dev  ->  mutex, que llama a input_ff_flush() adquiriendo ff  ->  mutex.\n\nSoluciona esto introduciendo un nuevo spinlock state_lock para proteger el acceso a udev  ->  state y udev  ->  dev en uinput_request_send() en lugar de adquirir udev  ->  mutex. La función solo necesita verificar atómicamente el estado del dispositivo y encolar un evento de entrada en el búfer circular a través de uinput_dev_event() - - ambas operaciones son seguras bajo un spinlock (ktime_get_ts64() y wake_up_interruptible() no se suspenden). Esto rompe el enlace ff  ->  mutex   ->   udev  ->  mutex ya que un spinlock es una hoja en el orden de bloqueo y no puede formar ciclos con mutexes.\n\nPara mantener las transiciones de estado visibles para uinput_request_send(), protege las escrituras en udev  ->  state en uinput_create_device() y uinput_destroy_device() con el mismo spinlock state_lock.\n\nAdemás, mueve init_completion(ref:request  ->  done) de uinput_request_send() a uinput_request_submit() antes de uinput_request_reserve_slot(). Una vez que la ranura es asignada, uinput_flush_requests() puede llamar a complete() sobre ella en cualquier momento desde la ruta de destrucción, por lo que la finalización debe ser inicializada antes de que la solicitud se haga visible.\n\nOrden de bloqueo después de la corrección:\n\nff  ->  mutex   ->   state_lock (spinlock, hoja)\nudev  ->  mutex   ->   state_lock (spinlock, hoja)\nudev  ->  mutex   ->   input_mutex   ->   dev  ->  mutex   ->   ff  ->  mutex (sin arista de retorno)","source":"nvd"}],"published":"2026-04-24T14:45:15.937Z","modified":"2026-11-11T23:10:00.263Z","severity":{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"},"severities":[{"scorer":"Linux","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","score":7.8,"rating":"HIGH"}],"cwes":["CWE-362","CWE-667"],"affected":[{"ranges":[{"type":"git","introduced":"ff462551235d8d7d843a005950bc90924fcedede","fixed":"71a9729f412e2c692a35c542e14b706fb342927f","status":"affected"},{"type":"git","introduced":"ff462551235d8d7d843a005950bc90924fcedede","fixed":"271ee71a1917b89f6d73ec82dd091c33d92ee617","status":"affected"},{"type":"git","introduced":"ff462551235d8d7d843a005950bc90924fcedede","fixed":"974f7b138c3a96dd5cd53d1b33409cd7b2229dc6","status":"affected"},{"type":"git","introduced":"ff462551235d8d7d843a005950bc90924fcedede","fixed":"546c18a14924eb521fe168d916d7ce28f1e13c1d","status":"affected"},{"type":"git","introduced":"ff462551235d8d7d843a005950bc90924fcedede","fixed":"a3d6c9c053c9c605651508569230ead633b13f76","status":"affected"},{"type":"git","introduced":"ff462551235d8d7d843a005950bc90924fcedede","fixed":"1e09dfbb4f5d20ee111f92325a00f85778a5f328","status":"affected"},{"type":"git","introduced":"ff462551235d8d7d843a005950bc90924fcedede","fixed":"1534661043c434b81cfde26b97a2fb2460329cf0","status":"affected"},{"type":"git","introduced":"ff462551235d8d7d843a005950bc90924fcedede","fixed":"4cda78d6f8bf2b700529f2fbccb994c3e826d7c2","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.19","status":"affected"},{"type":"semver","introduced":"0","fixed":"2.6.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.82","lastAffected":"6.12.*","status":"unaffected"},{"type":"semver","introduced":"6.18.23","lastAffected":"6.18.*","status":"unaffected"},{"type":"semver","introduced":"6.19.13","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":"2.6.19.1","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.82"},{"status":"affected","introduced":"6.13","fixed":"6.18.23"},{"status":"affected","introduced":"6.19","fixed":"6.19.13"},{"status":"affected","version":"2.6.19"},{"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"},{"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/71a9729f412e2c692a35c542e14b706fb342927f","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/271ee71a1917b89f6d73ec82dd091c33d92ee617","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/974f7b138c3a96dd5cd53d1b33409cd7b2229dc6","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/546c18a14924eb521fe168d916d7ce28f1e13c1d","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/a3d6c9c053c9c605651508569230ead633b13f76","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/1e09dfbb4f5d20ee111f92325a00f85778a5f328","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/1534661043c434b81cfde26b97a2fb2460329cf0","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/4cda78d6f8bf2b700529f2fbccb994c3e826d7c2","tags":["patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-10-16T15:11:55.311Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-31667","url":"https://www.cve.org/CVERecord?id=CVE-2026-31667","licence":"CVE Terms of Use","modified":"2026-10-19T18:56:02.976Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-31667","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31667","licence":"Public domain","modified":"2026-11-11T23:10:00.263Z"}],"updatedAt":"2026-11-25T22:59:19.542Z","epss":{"score":0.001,"percentile":0.00904,"date":"2026-12-01T12:00:22.000Z"}}