summaryrefslogtreecommitdiff
path: root/arch/powerpc
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2025-03-12 19:38:28 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:37:38 +0200
commit239ea3c34673b3244a499fd65771c47e5bffcbb0 (patch)
tree8df206f439a02fd0f9afaf2c44d29390cc20cd4b /arch/powerpc
parent324f280806aab28ef757aecc18df419676c10ef8 (diff)
downloadlinux-239ea3c34673b3244a499fd65771c47e5bffcbb0.tar.gz
linux-239ea3c34673b3244a499fd65771c47e5bffcbb0.tar.bz2
linux-239ea3c34673b3244a499fd65771c47e5bffcbb0.zip
spufs: fix a leak in spufs_create_context()
[ Upstream commit 0f5cce3fc55b08ee4da3372baccf4bcd36a98396 ] Leak fixes back in 2008 missed one case - if we are trying to set affinity and spufs_mkdir() fails, we need to drop the reference to neighbor. Fixes: 58119068cb27 "[POWERPC] spufs: Fix memory leak on SPU affinity" Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index a0f297581a66..3216245a648a 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -459,8 +459,11 @@ spufs_create_context(struct inode *inode, struct dentry *dentry,
}
ret = spufs_mkdir(inode, dentry, flags, mode & 0777);
- if (ret)
+ if (ret) {
+ if (neighbor)
+ put_spu_context(neighbor);
goto out_aff_unlock;
+ }
if (affinity) {
spufs_set_affinity(flags, SPUFS_I(d_inode(dentry))->i_ctx,