CVE-2026-139285: gpiolib: fix memory leak in gpiod_set_array_value_complex() EPERM error path
In the Linux kernel, the following vulnerability has been resolved:
gpiolib: fix memory leak in gpiodsetarrayvaluecomplex() EPERM error path
A drive-by review by Sashiko reports that, where the line has not been configured as an output, gpiodsetarrayvaluecomplex() can return without freeing potentially alloced bitmaps, thus leaking memory.
Cleanup the bitmaps before returning.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Compensating control
In gpiod_set_array_value_complex(), free any allocated bitmaps before returning on the EPERM error path.
Event History
Frequently Asked Questions
What condition triggers the memory leak?
The leak occurs when gpiod_set_array_value_complex() is called for a GPIO line that has not been configured as an output and takes the EPERM error path. Potentially allocated bitmaps are not freed before the function returns.
What is the practical impact of repeated triggering?
Repeated calls that reach this error path can leak kernel memory through the unfreed bitmaps. The provided information does not quantify the amount of memory leaked per call or identify a specific exploitation outcome.
What should be done if the fix cannot be applied immediately?
Avoid invoking gpiod_set_array_value_complex() on GPIO lines that are not configured as outputs. Ensure callers validate or configure the line direction as output before attempting to set array values.