Re: [PATCH 2/2] gpiolib: acpi: Fix resource leak in OpRegion cleanup path
From: Andy Shevchenko
Date: Tue May 19 2026 - 04:38:00 EST
On Tue, May 19, 2026 at 09:00:31AM +0200, Marco Scardovi (scardracs) wrote:
> If acpi_remove_address_space_handler() fails, the cleanup function
> acpi_gpiochip_free_regions() previously returned early. This leaks
> the connections list and all requested GPIO descriptors.
>
> Remove the early return statement so that connection cleanup and freeing
> of descriptors are always executed, preventing memory leaks in teardown
> failure paths.
Same problem may happen in the acpi_gpio_adr_space_handler().
What you need is to split the list and GPIO cleaning into a helper
which will be used in both cases.
This might need a Fixes tag.
> Assisted-by: Antigravity:gemini-3-flash
> Signed-off-by: Marco Scardovi <mscardovi95@xxxxxxxxx>
--
With Best Regards,
Andy Shevchenko