{"id":"CVE-2026-31732","aliases":["CVE-2026-31732"],"related":[],"kind":"vulnerability","state":"published","title":"gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()","summary":"In the Linux kernel, the following vulnerability has been resolved:\n\ngpio: Fix resource leaks on errors in gpiochip_add_data_with_key()\n\nSince commit aab5c6f20023 (\"gpio: set device type for GPIO chips\"),\n`gdev->dev.release` is unset.  As a result, the reference count to\n`gdev->dev` isn't dropped on the error handling paths.\n\nDrop the reference on errors.\n\nAlso reorder the instructions to make the error handling simpler.\nNow gpiochip_add_data_with_key() roughly looks like:\n\n   >>> Some memory allocation.  Go to ERR ZONE 1 on errors.\n   >>> device_initialize().\n\n   gpiodev_release() takes over the responsibility for freeing the\n   resources of `gdev->dev`.  The subsequent error handling paths\n   shouldn't go through ERR ZONE 1 again which leads to double free.\n\n   >>> Some initialization mainly on `gdev`.\n   >>> The rest of initialization.  Go to ERR ZONE 2 on errors.\n   >>> Chip registration success and exit.\n\n   >>> ERR ZONE 2.  gpio_device_put() and exit.\n   >>> ERR ZONE 1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"In the Linux kernel, the following vulnerability has been resolved:\n\ngpio: Fix resource leaks on errors in gpiochip_add_data_with_key()\n\nSince commit aab5c6f20023 (\"gpio: set device type for GPIO chips\"),\n`gdev->dev.release` is unset.  As a result, the reference count to\n`gdev->dev` isn't dropped on the error handling paths.\n\nDrop the reference on errors.\n\nAlso reorder the instructions to make the error handling simpler.\nNow gpiochip_add_data_with_key() roughly looks like:\n\n   >>> Some memory allocation.  Go to ERR ZONE 1 on errors.\n   >>> device_initialize().\n\n   gpiodev_release() takes over the responsibility for freeing the\n   resources of `gdev->dev`.  The subsequent error handling paths\n   shouldn't go through ERR ZONE 1 again which leads to double free.\n\n   >>> Some initialization mainly on `gdev`.\n   >>> The rest of initialization.  Go to ERR ZONE 2 on errors.\n   >>> Chip registration success and exit.\n\n   >>> ERR ZONE 2.  gpio_device_put() and exit.\n   >>> ERR ZONE 1.","source":"cvelist"},{"lang":"es","text":"En el kernel de Linux, la siguiente vulnerabilidad ha sido resuelta:\n\ngpio: Corrige fugas de recursos en errores en gpiochip_add_data_with_key()\n\nDesde el commit aab5c6f20023 (’gpio: establece el tipo de dispositivo para chips GPIO’),\n’gdev  ->  dev.release’ no está establecido. Como resultado, el recuento de referencias a\n’gdev  ->  dev’ no se libera en las rutas de manejo de errores.\n\nLibera la referencia en errores.\n\nTambién reordena las instrucciones para simplificar el manejo de errores.\nAhora gpiochip_add_data_with_key() se ve aproximadamente así:\n\n   >>> Alguna asignación de memoria. Ir a ZONA DE ERROR 1 en errores.\n   >>> device_initialize().\n\n   gpiodev_release() asume la responsabilidad de liberar los\n   recursos de ’gdev  ->  dev’. Las rutas de manejo de errores subsiguientes\n   no deberían pasar por ZONA DE ERROR 1 de nuevo, lo que lleva a una doble liberación.\n\n   >>> Alguna inicialización principalmente en ’gdev’.\n   >>> El resto de la inicialización. Ir a ZONA DE ERROR 2 en errores.\n   >>> Registro del chip exitoso y salida.\n\n   >>> ZONA DE ERROR 2. gpio_device_put() y salida.\n   >>> ZONA DE ERROR 1.","source":"nvd"}],"published":"2026-05-01T14:14:30.844Z","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":["CWE-401"],"affected":[{"ranges":[{"type":"git","introduced":"aab5c6f200238ac45001bec3d5494fff8438a8dc","fixed":"a500e1837c4266ddb05b39b3e1cc71f49a43ffa5","status":"affected"},{"type":"git","introduced":"aab5c6f200238ac45001bec3d5494fff8438a8dc","fixed":"f0cf9c7b7c281956cc0dec163132cd96f76e1d60","status":"affected"},{"type":"git","introduced":"aab5c6f200238ac45001bec3d5494fff8438a8dc","fixed":"fb4584d2b324c522404c733c65840a1a6519ada8","status":"affected"},{"type":"git","introduced":"aab5c6f200238ac45001bec3d5494fff8438a8dc","fixed":"16fdabe143fce2cbf89139677728e17e21b46c28","status":"affected"}],"vendor":"Linux","product":"Linux","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","source":"cvelist"},{"ranges":[{"version":"6.9","status":"affected"},{"type":"semver","introduced":"0","fixed":"6.9","status":"unaffected"},{"type":"semver","introduced":"6.12.95","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":"6.9","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/a500e1837c4266ddb05b39b3e1cc71f49a43ffa5","tags":[],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/f0cf9c7b7c281956cc0dec163132cd96f76e1d60","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/fb4584d2b324c522404c733c65840a1a6519ada8","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://git.kernel.org/stable/c/16fdabe143fce2cbf89139677728e17e21b46c28","tags":["patch"],"sources":["cvelist","nvd"]}],"credits":[],"assigner":"Linux","sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-31732","url":"https://www.cve.org/CVERecord?id=CVE-2026-31732","licence":"CVE Terms of Use","modified":"2026-07-04T11:50:32.706Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-31732","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-31732","licence":"Public domain","modified":"2026-11-11T21:10:00.200Z"}],"updatedAt":"2026-11-25T22:59:20.357Z","epss":{"score":0.00127,"percentile":0.02536,"date":"2026-12-01T12:00:22.000Z"}}