summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <johan+linaro@kernel.org>2023-03-06 10:56:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-03-22 15:28:08 +0300
commitf1e3a20c60196c37a402c584d0c9de306ba988ce (patch)
treef9740b4f05ac4702bffe2badd6ff732de8824a7e
parent325608ab60fa54c1413ac0264caa5f62113d926c (diff)
downloadlinux-f1e3a20c60196c37a402c584d0c9de306ba988ce.tar.xz
interconnect: fix mem leak when freeing nodes
commit a5904f415e1af72fa8fe6665aa4f554dc2099a95 upstream. The node link array is allocated when adding links to a node but is not deallocated when nodes are destroyed. Fixes: 11f1ceca7031 ("interconnect: Add generic on-chip interconnect API") Cc: stable@vger.kernel.org # 5.1 Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # i.MX8MP MSC SM2-MB-EP1 Board Link: https://lore.kernel.org/r/20230306075651.2449-2-johan+linaro@kernel.org Signed-off-by: Georgi Djakov <djakov@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/interconnect/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/interconnect/core.c b/drivers/interconnect/core.c
index e579b3633a84..e63c48a1602f 100644
--- a/drivers/interconnect/core.c
+++ b/drivers/interconnect/core.c
@@ -612,6 +612,10 @@ void icc_node_destroy(int id)
mutex_unlock(&icc_lock);
+ if (!node)
+ return;
+
+ kfree(node->links);
kfree(node);
}
EXPORT_SYMBOL_GPL(icc_node_destroy);