CVE-2026-143057

gpio: shared: fix a race in shared desc release path

Published Dec 3, 2026 CVSS n/a EPSS < 1% KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

gpio: shared: fix a race in shared desc release path

gpiod_shared_put() races with concurrent calls to
devm_gpiod_shared_get() like so:

CPU 0 (unbind / probe failure) CPU 1 (concurrent proxy probe)
============================== ==============================
gpiod_shared_put()
kref_put(&entry->ref, ...)
refcount_dec_and_test() // -> 0
devm_gpiod_shared_get()
mutex_lock(&entry->lock);
if (entry->shared_desc) {
kref_get(&entry->ref); // on 0!
shared_desc = entry->shared_desc;
}
mutex_unlock(&entry->lock);
gpio_shared_release()
mutex_lock(&entry->lock);
kfree(shared_desc);
entry->shared_desc = NULL;
mutex_unlock(&entry->lock);
// uses freed shared_desc

Because gpiod_shared_put() decrements entry->ref without holding
entry->lock and gpio_shared_release() only acquires entry->lock after the
reference count has already reached zero, a concurrent call to
devm_gpiod_shared_get() can acquire entry->lock in the intermediate window
and observe a non-NULL entry->shared_desc. This can result in a
use-after-free and a double-free when the second consumer releases its
reference.

Use kref_put_mutex() to ensure the entry lock is taken without a window
in which a concurrent user can see a non-NULL entry->shared_desc while
it's being released.

Analysis

No analysis available yet

Remediation

No remediation available yet

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: gpio: shared: fix a race in shared desc release path gpiod_shared_put() races with concurrent calls to devm_gpiod_shared_get() like so: CPU 0 (unbind / probe failure) CPU 1 (concurrent proxy probe) ============================== ============================== gpiod_shared_put() kref_put(&entry->ref, ...) refcount_dec_and_test() // -> 0 devm_gpiod_shared_get() mutex_lock(&entry->lock); if (entry->shared_desc) { kref_get(&entry->ref); // on 0! shared_desc = entry->shared_desc; } mutex_unlock(&entry->lock); gpio_shared_release() mutex_lock(&entry->lock); kfree(shared_desc); entry->shared_desc = NULL; mutex_unlock(&entry->lock); // uses freed shared_desc Because gpiod_shared_put() decrements entry->ref without holding entry->lock and gpio_shared_release() only acquires entry->lock after the reference count has already reached zero, a concurrent call to devm_gpiod_shared_get() can acquire entry->lock in the intermediate window and observe a non-NULL entry->shared_desc. This can result in a use-after-free and a double-free when the second consumer releases its reference. Use kref_put_mutex() to ensure the entry lock is taken without a window in which a concurrent user can see a non-NULL entry->shared_desc while it's being released.
Title gpio: shared: fix a race in shared desc release path
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses

No weakness.

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Dec 3, 2026, 9:18 AM
Reserved
Dec 3, 2026, 3:10 AM
Status
Received
Published
Dec 3, 2026, 10:17 AM
Modified
Dec 3, 2026, 10:17 AM