CVE-2026-43181 Overview
CVE-2026-43181 is a Linux kernel vulnerability in the General Purpose Input/Output (GPIO) sysfs interface. The flaw occurs when a GPIO is exported through /sys/class/gpio and the parent GPIO controller is subsequently unbound. The teardown logic in gpiod_unexport() cannot associate the descriptor with the removed parent device, leaving the exported sysfs attribute in place and never dropping the final reference. This produces a stale sysfs entry tied to a kernel object that has already been torn down, creating a kernel resource management defect [CWE-672: Operation on a Resource after Expiration or Release].
Critical Impact
Unbinding a GPIO controller while GPIO lines remain exported via sysfs leaves dangling sysfs attributes and leaked references in the kernel, which can destabilize systems that hot-remove GPIO providers.
Affected Products
- Linux kernel versions containing the gpio: sysfs teardown logic prior to commits 54f4634, 6766f59, and a645cc2
- Distributions and embedded systems shipping the affected upstream kernel branches
- Hardware platforms that hot-add or hot-remove GPIO controllers (for example, expander chips on hot-pluggable buses)
Discovery Timeline
- 2026-05-06 - CVE-2026-43181 published to NVD
- 2026-05-06 - Last updated in NVD database
Technical Details for CVE-2026-43181
Vulnerability Analysis
The Linux kernel exposes individual GPIO lines to userspace through the legacy sysfs interface at /sys/class/gpio. When a user writes a line number to export, the kernel creates a corresponding sysfs attribute and pins references to the underlying gpio_desc and its parent gpio_chip. The defect lies in the ordering of teardown when the parent GPIO controller is removed before the user calls unexport.
Once the parent device is unregistered, gpiod_unexport() can no longer resolve the descriptor back to the parent. The function therefore fails to remove the sysfs attribute and never drops the final reference. The result is a residual entry under /sys/class/gpio pointing at freed or partially torn-down kernel state.
Root Cause
The root cause is a teardown ordering bug. The existing code path acquires sysfs_lock inside gpiod_unexport() and depends on the parent device still being live. When the controller is unbound first, the lookup path breaks and the cleanup is skipped. The fix introduces an unlocked variant of gpiod_unexport() and removes all exported GPIOs while holding sysfs_lock before unregistering the parent device, blocking new exports during teardown.
Attack Vector
Triggering the condition requires local access with privileges to export GPIOs through sysfs and to unbind the GPIO controller driver, typically root. An actor who can script echo <n> > /sys/class/gpio/export followed by unbind operations on the parent driver can reproduce the leak repeatedly. The practical impact is kernel resource leakage, stale sysfs nodes, and potential instability rather than direct memory corruption from a remote vector. See the upstream fixes in Kernel Git Commit 54f4634, Kernel Git Commit 6766f59, and Kernel Git Commit a645cc2.
Detection Methods for CVE-2026-43181
Indicators of Compromise
- Persistent gpioN entries under /sys/class/gpio/ after the corresponding GPIO controller has been unbound from its driver
- Kernel log messages relating to gpiochip_remove while GPIOs remain exported
- Reference count anomalies on gpio_chip objects observed through kref or device model debugging
Detection Strategies
- Audit running kernels against the patched commits listed in the upstream references and flag systems running unpatched stable branches
- Monitor for userspace or init scripts that combine /sys/class/gpio/export with unbind writes to GPIO controller sysfs paths
- Correlate dmesg warnings about GPIO sysfs cleanup with subsequent device probe failures
Monitoring Recommendations
- Collect kernel logs centrally and alert on repeated GPIO teardown warnings on embedded fleets and hypervisors
- Track package and kernel inventory across Linux endpoints to confirm patched versions are deployed
- Watch for unexpected privileged writes to /sys/bus/*/drivers/*/unbind paths from non-administrative workflows
How to Mitigate CVE-2026-43181
Immediate Actions Required
- Apply the upstream Linux kernel fixes referenced in commits 54f4634, 6766f59, and a645cc2 or the equivalent vendor backports
- Restrict access to /sys/class/gpio/export and to driver unbind interfaces to administrative users only
- On systems that cannot be patched immediately, avoid unbinding GPIO controllers while lines are exported through sysfs
Patch Information
The vulnerability is resolved in the Linux kernel by reworking the GPIO sysfs teardown path. The fix adds an unlocked variant of gpiod_unexport() and removes all exported GPIOs with sysfs_lock held before the parent device is unregistered. This prevents new exports during teardown and ensures the final descriptor reference is dropped. Refer to Kernel Git Commit 54f4634, Kernel Git Commit 6766f59, and Kernel Git Commit a645cc2.
Workarounds
- Migrate management tooling from the legacy /sys/class/gpio interface to the character device interface at /dev/gpiochipN, which is not affected by this teardown path
- Disable CONFIG_GPIO_SYSFS in custom kernel builds where the legacy interface is not required
- Enforce an operational policy that calls unexport for every previously exported line before unbinding the parent GPIO driver
# Configuration example: verify kernel version and disable legacy GPIO sysfs in custom builds
uname -r
grep CONFIG_GPIO_SYSFS /boot/config-$(uname -r)
# In a custom kernel .config, set:
# CONFIG_GPIO_SYSFS=n
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.


