[PATCH v2] gpio: aspeed: Fix potential coprocessor bank map leak
Bartosz Golaszewski
brgl at kernel.org
Thu Nov 26 06:10:53 PST 2026
On Tue, Nov 24, 2026 at 09:58:32PM +0800, Guangshuo Li wrote:
> The coprocessor bank map is allocated lazily but is never freed when
> the GPIO controller is removed. Its only owner is the device-managed
> GPIO private data.
>
> Allocate the map with the controller's managed resources before
> registering the GPIO chip, so chip removal finishes before the map
> is freed. Round up the bank count to cover a partial last bank.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: a7ca13826e47 ("gpio: aspeed: Add interfaces for co-processor to grab GPIOs")
> Cc: stable at vger.kernel.org
> Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>
> ---
> Changes in v2:
> - Use a managed array allocation instead of a cleanup action.
> - Allocate before GPIO-chip registration so teardown callbacks finish
> before the bank map is freed.
> - Round up the array size to cover a partial last bank.
Please also include a lore link to the previous versions in the
changelog.
Bart
More information about the linux-arm-kernel
mailing list