From 5c64d1c99f550e73d524782cd3d34542b85a8e34 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 20 Mar 2023 10:26:37 +0100 Subject: [PATCH] 5.4-stable patches added patches: interconnect-fix-mem-leak-when-freeing-nodes.patch --- ...nect-fix-mem-leak-when-freeing-nodes.patch | 37 +++++++++++++++++++ queue-5.4/series | 1 + 2 files changed, 38 insertions(+) create mode 100644 queue-5.4/interconnect-fix-mem-leak-when-freeing-nodes.patch diff --git a/queue-5.4/interconnect-fix-mem-leak-when-freeing-nodes.patch b/queue-5.4/interconnect-fix-mem-leak-when-freeing-nodes.patch new file mode 100644 index 00000000000..446f21fbf7a --- /dev/null +++ b/queue-5.4/interconnect-fix-mem-leak-when-freeing-nodes.patch @@ -0,0 +1,37 @@ +From a5904f415e1af72fa8fe6665aa4f554dc2099a95 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Mon, 6 Mar 2023 08:56:29 +0100 +Subject: interconnect: fix mem leak when freeing nodes + +From: Johan Hovold + +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 +Signed-off-by: Johan Hovold +Tested-by: Luca Ceresoli # 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 +Signed-off-by: Greg Kroah-Hartman +--- + drivers/interconnect/core.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- 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); diff --git a/queue-5.4/series b/queue-5.4/series index d1e71e451cf..3b85496c1f1 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -43,3 +43,4 @@ drm-amdkfd-fix-an-illegal-memory-access.patch sh-intc-avoid-spurious-sizeof-pointer-div-warning.patch ext4-fix-possible-double-unlock-when-moving-a-directory.patch tty-serial-fsl_lpuart-skip-waiting-for-transmission-complete-when-uartctrl_sbk-is-asserted.patch +interconnect-fix-mem-leak-when-freeing-nodes.patch -- 2.47.3