From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87C233793BA for ; Tue, 4 Aug 2026 11:37:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785843442; cv=none; b=ZbWSrKQ3gUz3mciGPOFiqgYqj7dBiVl/9JIwVQ4Hhitc+qM1aV7nTU+ywbA5xa6pC61juxaw3brQRs0ldbFJnhTa9ekACuIMa0EP8hKFLumd4dS75OE2MwryagJv1VZS/x0J5i819Bc/os8r4g+nMBRJAgVSE9tlNbLa4rCrBgg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785843442; c=relaxed/simple; bh=xP+uSzjBi5Wq/EoN8eVH5Zm1zjYzVrbRyULEVaRkUY4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=BZJcRu8ynRZrzZ5UJ87IeFUZ10dh3eLMfRN8/S8nYc1uDc+Ml4lfX5ME0siwMHy3tejK7VOCMp7C/IaLGeAgD+v0eE5lpRyQTU/i2xSKt/y4xsZIxLRlDnjwn08jeUJbFfid1aqWllHXNyWX1DyKI9VKKlwCjLA/6B9jfmie7kE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=VJT0ySdH; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="VJT0ySdH" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1785843437; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=rNGq6F5u+ec8AaPXAvpZxL4+irPU2jtOcDSueug9CII=; b=VJT0ySdHLqF78y10Wmz4IGmABflVYGQ7Bt0OCfU2KjeqpBF3B+HZgvHfG8MIQwN/S6gF1/ e6V98/VeufpvyTIh2K7vugJBxfyq50f69fsJcIBGvivFqnHsYNsTKdXiUnHnvhswdO5hSl BkeA8spNrLY1wCOlZhIUGaHFnW4ReFQ= From: Thorsten Blum To: Geoff Levand , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Arnd Bergmann Cc: Thorsten Blum , stable@vger.kernel.org, Geoff Levand , 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 Message-ID: <20260804113712.60967-2-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1100; i=thorsten.blum@linux.dev; h=from:subject; bh=xP+uSzjBi5Wq/EoN8eVH5Zm1zjYzVrbRyULEVaRkUY4=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFmF517IzLkz/d7MVYaNN+2OaXK6FYi+3vydMaYtYeetR fXLv2rodpSyMIhxMciKKbI8mPVjhm9pTeUmk4idMHNYmUCGMHBxCsBEfloy/JW+bC7cJLTaL91/ l+rJwI1R9W9MJ77hMm7xZhG/75IxfQojw5SZBv7Kn+YFrr9euun9szD2P3kVk6/e953e87NBRsV BmAUA X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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 --- 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; }