]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
leds: netxbig: Fix GPIO descriptor leak in error paths
authorHaotian Zhang <vulab@iscas.ac.cn>
Fri, 31 Oct 2025 02:16:20 +0000 (10:16 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Dec 2025 13:02:58 +0000 (14:02 +0100)
commit659dd9c8cd59d09481c3be17607171285c63dfee
treedb6b9c79c297b851bd59d49b17d10e39fb21a20d
parent54a7e83112742d75c19226665a729113f16165ae
leds: netxbig: Fix GPIO descriptor leak in error paths

[ Upstream commit 03865dd8af52eb16c38062df2ed30a91b604780e ]

The function netxbig_gpio_ext_get() acquires GPIO descriptors but
fails to release them when errors occur mid-way through initialization.
The cleanup callback registered by devm_add_action_or_reset() only
runs on success, leaving acquired GPIOs leaked on error paths.

Add goto-based error handling to release all acquired GPIOs before
returning errors.

Fixes: 9af512e81964 ("leds: netxbig: Convert to use GPIO descriptors")
Suggested-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
Link: https://patch.msgid.link/20251031021620.781-1-vulab@iscas.ac.cn
Signed-off-by: Lee Jones <lee@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/leds/leds-netxbig.c