All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] powerpc: Fix a memory leak in error handling paths
@ 2021-04-23 14:40 ` Christophe JAILLET
  0 siblings, 0 replies; 6+ messages in thread
From: Christophe JAILLET @ 2021-04-23 14:40 UTC (permalink / raw)
  To: benh, mpe, paulus, gustavoars, robh
  Cc: linuxppc-dev, linux-kernel, kernel-janitors, Christophe JAILLET

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@wanadoo.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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-04-23 14:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 14:40 [PATCH 1/2] powerpc: Fix a memory leak in error handling paths Christophe JAILLET
2021-04-23 14:40 ` Christophe JAILLET
2021-04-23 14:40 ` [PATCH 2/2] powerpc: Save a few lines of code Christophe JAILLET
2021-04-23 14:40   ` Christophe JAILLET
2021-04-23 14:55 ` [PATCH 1/2] powerpc: Fix a memory leak in error handling paths Rob Herring
2021-04-23 14:55   ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.