]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pinctrl: sunxi: Fix memory leak on krealloc failure
authorYuan Chen <chenyuan@kylinos.cn>
Fri, 20 Jun 2025 01:27:08 +0000 (09:27 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 15 Aug 2025 10:05:02 +0000 (12:05 +0200)
commitb5ba40b70ab27447c9b5b9f0bdee049b62fa8c90
treec86f9131fa8fee331bfea0869b2d2a80809e08c0
parentbf88b2b3fd5f3bc7a467858f313f81012cecdad3
pinctrl: sunxi: Fix memory leak on krealloc failure

[ Upstream commit e3507c56cbb208d4f160942748c527ef6a528ba1 ]

In sunxi_pctrl_dt_node_to_map(), when krealloc() fails to resize
the pinctrl_map array, the function returns -ENOMEM directly
without freeing the previously allocated *map buffer. This results
in a memory leak of the original kmalloc_array allocation.

Fixes: e11dee2e98f8 ("pinctrl: sunxi: Deal with configless pins")
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Link: https://lore.kernel.org/20250620012708.16709-1-chenyuan_fl@163.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pinctrl/sunxi/pinctrl-sunxi.c