]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
interconnect: icc-clk: destroy nodes in case of memory allocation failures
authorGabor Juhos <j4g8y7@gmail.com>
Wed, 25 Jun 2025 17:32:35 +0000 (19:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Aug 2025 08:51:23 +0000 (09:51 +0100)
commitce1ef047066dc74a7d600d9e2e9081fdcc764cef
tree0cbd4010982663eee0adf70500ff71a705bf40a9
parentb94a400bab54dabc0a75227b9ad567ed92edf286
interconnect: icc-clk: destroy nodes in case of memory allocation failures

[ Upstream commit 618c810a7b2163517ab1875bd56b633ca3cb3328 ]

When memory allocation fails during creating the name of the nodes in
icc_clk_register(), the code continues on the error path and it calls
icc_nodes_remove() to destroy the already created nodes. However that
function only destroys the nodes which were already added to the provider
and the newly created nodes are never destroyed in case of error.

In order to avoid a memory leaks, change the code to destroy the newly
created nodes explicitly in case of memory allocation failures.

Fixes: 44c5aa73ccd1 ("interconnect: icc-clk: check return values of devm_kasprintf()")
Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250625-icc-clk-memleak-fix-v1-1-4151484cd24f@gmail.com
Signed-off-by: Georgi Djakov <djakov@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/interconnect/icc-clk.c