]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spufs: fix a leak in spufs_create_context()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 12 Mar 2025 23:38:28 +0000 (19:38 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 13 Mar 2025 02:13:36 +0000 (22:13 -0400)
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>
arch/powerpc/platforms/cell/spufs/inode.c

index c566e7997f2c1a676cadc2024737667a90307655..9f9e4b871627826223d42eca55d1cd55e9cb9b30 100644 (file)
@@ -460,8 +460,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,