[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20251204102047.85545-1-haoxiang_li2024@163.com>
Date: Thu, 4 Dec 2025 18:20:47 +0800
From: Haoxiang Li <haoxiang_li2024@....com>
To: maddy@...ux.ibm.com,
mpe@...erman.id.au,
npiggin@...il.com,
christophe.leroy@...roup.eu,
haoxiang_li2024@....com,
kay.sievers@...y.org,
gregkh@...e.de
Cc: linuxppc-dev@...ts.ozlabs.org,
linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: [PATCH] powerpc: cell: Fix a reference leak bug in create_spu()
spu_create_dev() calls device_register(), if it fails, put_device()
is required to drop the device reference.
Fixes: 8a25a2fd126c ("cpu: convert 'cpu' and 'machinecheck' sysdev_class to a regular subsystem")
Cc: stable@...r.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@....com>
---
arch/powerpc/platforms/cell/spu_base.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index 2c07387201d0..18145142d3ac 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -581,8 +581,10 @@ static int __init create_spu(void *data)
goto out_destroy;
ret = spu_create_dev(spu);
- if (ret)
+ if (ret) {
+ put_device(&spu->dev);
goto out_free_irqs;
+ }
mutex_lock(&cbe_spu_info[spu->node].list_mutex);
list_add(&spu->cbe_list, &cbe_spu_info[spu->node].spus);
--
2.25.1
Powered by blists - more mailing lists