[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <f2186955f310494f10990b5c402ada164d7834b8.1619188632.git.christophe.jaillet@wanadoo.fr>
Date: Fri, 23 Apr 2021 16:40:35 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: benh@...nel.crashing.org, mpe@...erman.id.au, paulus@...ba.org,
gustavoars@...nel.org, robh@...nel.org
Cc: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: [PATCH 1/2] powerpc: Fix a memory leak in error handling paths
If we exit the for_each_of_cpu_node loop early, the reference on the
current node must be decremented, otherwise there is a leak.
Fixes: a94fe366340a ("powerpc: use for_each_of_cpu_node iterator")
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
Strangely, the commit above added the needed of_node_put in one place but
missed 2 other places!
This is strange, so maybe I misunderstand something. Review carefully
---
arch/powerpc/platforms/powermac/feature.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 5c77b9a24c0e..e612222f7d2e 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -1060,6 +1060,7 @@ core99_reset_cpu(struct device_node *node, long param, long value)
continue;
if (param == *num) {
reset_io = *rst;
+ of_node_put(np);
break;
}
}
@@ -1506,6 +1507,7 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
continue;
if (param == *num) {
reset_io = *rst;
+ of_node_put(np);
break;
}
}
--
2.27.0
Powered by blists - more mailing lists