{"id":"CVE-2026-31732","published":"2026-05-01T14:14:30Z","modified":"2026-07-04T11:50:32Z","title":"gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()","vendor":"Linux","product":"Linux","tier":"tail","description":{"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.","provenance":"source","from":"CVE.org"},"cvss":null,"epss":{"score":0.00122,"percentile":0.01958,"provenance":"source"},"cwes":[],"references":[{"url":"https://git.kernel.org/stable/c/a500e1837c4266ddb05b39b3e1cc71f49a43ffa5","tags":[]},{"url":"https://git.kernel.org/stable/c/f0cf9c7b7c281956cc0dec163132cd96f76e1d60","tags":[]},{"url":"https://git.kernel.org/stable/c/fb4584d2b324c522404c733c65840a1a6519ada8","tags":[]},{"url":"https://git.kernel.org/stable/c/16fdabe143fce2cbf89139677728e17e21b46c28","tags":[]}],"priority":{"score":0.4,"factors":[{"name":"EPSS percentile","points":0.39}]},"vendorSlug":"linux","affectedVersions":[{"vendor":"Linux","product":"Linux","versions":[">= aab5c6f200238ac45001bec3d5494fff8438a8dc, < a500e1837c4266ddb05b39b3e1cc71f49a43ffa5",">= aab5c6f200238ac45001bec3d5494fff8438a8dc, < f0cf9c7b7c281956cc0dec163132cd96f76e1d60",">= aab5c6f200238ac45001bec3d5494fff8438a8dc, < fb4584d2b324c522404c733c65840a1a6519ada8",">= aab5c6f200238ac45001bec3d5494fff8438a8dc, < 16fdabe143fce2cbf89139677728e17e21b46c28"]},{"vendor":"Linux","product":"Linux","versions":["6.9"]}],"euvd":{"id":"EUVD-2026-26545","exploited":false,"provenance":"source"}}