From: Thorsten Blum <thorsten.blum@linux.dev>
To: Geoff Levand <geoff@infradead.org>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
Arnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
stable@vger.kernel.org,
Geoff Levand <geoffrey.levand@am.sony.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH] powerpc/ps3: Fix failure paths in ps3_create_spu()
Date: Tue, 4 Aug 2026 13:37:12 +0200 [thread overview]
Message-ID: <20260804113712.60967-2-thorsten.blum@linux.dev> (raw)
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;
}
reply other threads:[~2026-08-04 11:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260804113712.60967-2-thorsten.blum@linux.dev \
--to=thorsten.blum@linux.dev \
--cc=arnd.bergmann@de.ibm.com \
--cc=chleroy@kernel.org \
--cc=geoff@infradead.org \
--cc=geoffrey.levand@am.sony.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=npiggin@gmail.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox