{"id":"CVE-2026-143246","state":"PUBLISHED","title":"gpiolib: fix GPIO descriptor leak in gpiod_get_array()","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ngpiolib: fix GPIO descriptor leak in gpiod_get_array()\n\nIn gpiod_get_array(), descs->ndescs is used as the loop induction\nvariable and is only incremented at the end of each iteration. When\nkrealloc() fails on the first iteration (when index is 0),\ndescs->desc[0] has already been acquired via gpiod_get_index(), but\ndescs->ndescs is still 0. Consequently, gpiod_put_array() frees descs\nwithout releasing descs->desc[0], leaking the descriptor.\n\nFix this by using a dedicated loop induction variable and incrementing\ndescs->ndescs immediately upon storing the retrieved descriptor.\nAdditionally, since the fast-path array_info setup only executes for the\nfirst element (index 0), simplify the bitmap_set() calls to start at bit\n0 for count bits instead of calculating offsets from the loop index.","publishedAt":"2026-12-03T09:20:56.976Z","updatedAt":"2026-12-03T09:20:56.976Z","severity":null,"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"bf9346f5d47b4506aafbc384dfb5796b0adc3f8d","status":"affected","lessThan":"5e22a760a23ee3298b525b1bc6b0647272d6bf4b","versionType":"git"},{"version":"bf9346f5d47b4506aafbc384dfb5796b0adc3f8d","status":"affected","lessThan":"233b889db63c316ec558db34ae15dcb4784dc39f","versionType":"git"},{"version":"bf9346f5d47b4506aafbc384dfb5796b0adc3f8d","status":"affected","lessThan":"b2a161687acdc297aa91fec7fa0966b5aecf0d16","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpio/gpiolib.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.20","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.20","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpio/gpiolib.c"]}],"references":["https://git.kernel.org/stable/c/5e22a760a23ee3298b525b1bc6b0647272d6bf4b","https://git.kernel.org/stable/c/233b889db63c316ec558db34ae15dcb4784dc39f","https://git.kernel.org/stable/c/b2a161687acdc297aa91fec7fa0966b5aecf0d16"],"weaknesses":[],"ingestedAt":"2026-12-03T09:42:04.348Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2026/143xxx/CVE-2026-143246.json","commit":"9e309c7c0f08856e2558a1df33f75dca027fab70","baselineCommit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2026-143246","state":"PUBLISHED","datePublished":"2026-12-03T09:20:56.976Z","dateUpdated":"2026-12-03T09:20:56.976Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2026-12-03T03:10:28.362Z"},"containers":{"cna":{"title":"gpiolib: fix GPIO descriptor leak in gpiod_get_array()","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ngpiolib: fix GPIO descriptor leak in gpiod_get_array()\n\nIn gpiod_get_array(), descs->ndescs is used as the loop induction\nvariable and is only incremented at the end of each iteration. When\nkrealloc() fails on the first iteration (when index is 0),\ndescs->desc[0] has already been acquired via gpiod_get_index(), but\ndescs->ndescs is still 0. Consequently, gpiod_put_array() frees descs\nwithout releasing descs->desc[0], leaking the descriptor.\n\nFix this by using a dedicated loop induction variable and incrementing\ndescs->ndescs immediately upon storing the retrieved descriptor.\nAdditionally, since the fast-path array_info setup only executes for the\nfirst element (index 0), simplify the bitmap_set() calls to start at bit\n0 for count bits instead of calculating offsets from the loop index."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"bf9346f5d47b4506aafbc384dfb5796b0adc3f8d","status":"affected","lessThan":"5e22a760a23ee3298b525b1bc6b0647272d6bf4b","versionType":"git"},{"version":"bf9346f5d47b4506aafbc384dfb5796b0adc3f8d","status":"affected","lessThan":"233b889db63c316ec558db34ae15dcb4784dc39f","versionType":"git"},{"version":"bf9346f5d47b4506aafbc384dfb5796b0adc3f8d","status":"affected","lessThan":"b2a161687acdc297aa91fec7fa0966b5aecf0d16","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpio/gpiolib.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"4.20","status":"affected"},{"version":"0","status":"unaffected","lessThan":"4.20","versionType":"semver"},{"version":"6.18.66","status":"unaffected","lessThanOrEqual":"6.18.*","versionType":"semver"},{"version":"7.3.7","status":"unaffected","lessThanOrEqual":"7.3.*","versionType":"semver"},{"version":"7.4-rc3","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/gpio/gpiolib.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/5e22a760a23ee3298b525b1bc6b0647272d6bf4b"},{"url":"https://git.kernel.org/stable/c/233b889db63c316ec558db34ae15dcb4784dc39f"},{"url":"https://git.kernel.org/stable/c/b2a161687acdc297aa91fec7fa0966b5aecf0d16"}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-12-03T09:20:56.976Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.20","versionEndExcluding":"6.18.66"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.20","versionEndExcluding":"7.3.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"4.20","versionEndExcluding":"7.4-rc3"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}