The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] powerpc/ps3: Fix failure paths in ps3_create_spu()
@ 2026-08-04 11:37 Thorsten Blum
  0 siblings, 0 replies; only message in thread
From: Thorsten Blum @ 2026-08-04 11:37 UTC (permalink / raw)
  To: Geoff Levand, Madhavan Srinivasan, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy (CS GROUP), Arnd Bergmann
  Cc: Thorsten Blum, stable, Geoff Levand, linuxppc-dev, linux-kernel

ps3_destroy_spu() expects the logical SPE to be constructed and enabled
successfully. However, ps3_create_spu() calls ps3_destroy_spu() when
either construct_spu() or enable_spu() failed.

Only free spu->pdata when construct_spu() fails. If construct_spu()
succeeded but enable_spu() fails, destruct the logical SPE before
freeing spu->pdata.

Fixes: de91a5342995 ("[POWERPC] ps3: add spu support")
Cc: stable@vger.kernel.org
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 arch/powerpc/platforms/ps3/spu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/ps3/spu.c b/arch/powerpc/platforms/ps3/spu.c
index 33a676fa3d6c..05c439fed8a7 100644
--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -369,8 +369,10 @@ static int __init ps3_create_spu(struct spu *spu, void *data)
 	return result;
 
 fail_enable:
+	BUG_ON(lv1_destruct_logical_spe(spu_pdata(spu)->spe_id));
 fail_construct:
-	ps3_destroy_spu(spu);
+	kfree(spu->pdata);
+	spu->pdata = NULL;
 fail_malloc:
 	return result;
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-04 11:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04 11:37 [PATCH] powerpc/ps3: Fix failure paths in ps3_create_spu() Thorsten Blum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox