CVE-2026-31732

gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()

Published May 1, 2026 CVSS 3.1 · 5.5 Medium EPSS < 1% KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()

Since commit aab5c6f20023 ("gpio: set device type for GPIO chips"),
`gdev->dev.release` is unset. As a result, the reference count to
`gdev->dev` isn't dropped on the error handling paths.

Drop the reference on errors.

Also reorder the instructions to make the error handling simpler.
Now gpiochip_add_data_with_key() roughly looks like:

>>> Some memory allocation. Go to ERR ZONE 1 on errors.
>>> device_initialize().

gpiodev_release() takes over the responsibility for freeing the
resources of `gdev->dev`. The subsequent error handling paths
shouldn't go through ERR ZONE 1 again which leads to double free.

>>> Some initialization mainly on `gdev`.
>>> The rest of initialization. Go to ERR ZONE 2 on errors.
>>> Chip registration success and exit.

>>> ERR ZONE 2. gpio_device_put() and exit.
>>> ERR ZONE 1.

Analysis

AI-generated

Technical impact

A flaw in the Linux kernel’s GPIO subsystem causes the reference count on a device structure to remain unreleased when the gpiochip_add_data_with_key() function encounters an error. This mismanagement can lead to a resource leak or, in the worst case, a double free that corrupts kernel memory. The vulnerability does not provide a direct remote code execution path; it would require an attacker to be able to trigger the specific error handling path within the kernel, implying a local privilege escalation or root context is necessary for exploitation.

Affected Systems

The issue affects Linux kernel builds that omit the commit aab5c6f20023 which introduced proper release handling. Because the affected versions are not enumerated in the CVE payload, systems running any kernel that predates this commit are potentially at risk. Distributions that provide a patched kernel, even if the exact release is not specified, are considered protected.

Risk and Exploitability

The CVSS score is 5.5, the EPSS score is < 1%—indicating a very low probability of exploitation—and the vulnerability is not listed in CISA’s KEV catalog, so quantitative risk estimates cannot be precisely defined. The likely attack vector requires local privilege or kernel context to trigger the error handling path, a condition inferred from the description; the risk evaluation is also inferred. Nonetheless, a double free in kernel code can trigger a panic or allow a local attacker to corrupt kernel memory, so the risk is non‑negligible for affected systems. The lack of a publicly documented exploit reduces the current threat level, but the kernel crash potential warrants timely remediation.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade the Linux kernel to a version that contains the aab5c6f20023 commit (for example, the most recent stable release from the kernel maintainers).
  • If the distribution does not yet ship the updated kernel, apply the commit to the kernel source tree, rebuild the kernel, and install the patched image.
  • In environments where a kernel rebuild is not feasible, consider disabling or removing modules that load the faulty GPIO chip drivers to reduce the attack surface until a patch is available.

Generated by OpenCVE AI on May 7, 2026 at 16:53 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DSA Debian DSA DSA-6381-1 linux security update
History
Type Values Removed Values Added
Weaknesses CWE-401
CPEs cpe:2.3:o:linux:linux_kernel:7.0:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:7.0:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:7.0:rc3:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:7.0:rc4:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:7.0:rc5:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:7.0:rc6:*:*:*:*:*:*
Type Values Removed Values Added
Weaknesses CWE-911
References
Metrics threat_severity

None

cvssV3_1

{'score': 5.5, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H'}

threat_severity

Low

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: gpio: Fix resource leaks on errors in gpiochip_add_data_with_key() Since commit aab5c6f20023 ("gpio: set device type for GPIO chips"), `gdev->dev.release` is unset. As a result, the reference count to `gdev->dev` isn't dropped on the error handling paths. Drop the reference on errors. Also reorder the instructions to make the error handling simpler. Now gpiochip_add_data_with_key() roughly looks like: >>> Some memory allocation. Go to ERR ZONE 1 on errors. >>> device_initialize(). gpiodev_release() takes over the responsibility for freeing the resources of `gdev->dev`. The subsequent error handling paths shouldn't go through ERR ZONE 1 again which leads to double free. >>> Some initialization mainly on `gdev`. >>> The rest of initialization. Go to ERR ZONE 2 on errors. >>> Chip registration success and exit. >>> ERR ZONE 2. gpio_device_put() and exit. >>> ERR ZONE 1.
Title gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-401

    Missing Release of Memory after Effective Lifetime

  • CWE-911

    Improper Update of Reference Count

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Jul 4, 2026, 11:50 AM
Reserved
Mar 9, 2026, 3:48 PM
Status
Modified
Published
May 1, 2026, 3:16 PM
Modified
Nov 11, 2026, 9:10 PM
Severity
Low
Public date
May 1, 2026, 12:00 AM