]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
spufs: fix a leak on spufs_new_file() failure
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 9 Mar 2025 00:26:31 +0000 (19:26 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 13 Mar 2025 02:13:27 +0000 (22:13 -0400)
It's called from spufs_fill_dir(), and caller of that will do
spufs_rmdir() in case of failure.  That does remove everything
we'd managed to create, but... the problem dentry is still
negative.  IOW, it needs to be explicitly dropped.

Fixes: 3f51dd91c807 "[PATCH] spufs: fix spufs_fill_dir error path"
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
arch/powerpc/platforms/cell/spufs/inode.c

index 70236d1df3d3e09713a2633f7dc060f9348674c4..793c005607cf0ff9492dcbb94699cbde6960f7bd 100644 (file)
@@ -192,8 +192,10 @@ static int spufs_fill_dir(struct dentry *dir,
                        return -ENOMEM;
                ret = spufs_new_file(dir->d_sb, dentry, files->ops,
                                        files->mode & mode, files->size, ctx);
-               if (ret)
+               if (ret) {
+                       dput(dentry);
                        return ret;
+               }
                files++;
        }
        return 0;