Message ID | 20250313042815.GA2123707@ZenIV (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [1/4] spufs: fix a leak on spufs_new_file() failure | expand |
On Thu, Mar 13, 2025 at 04:28:15AM +0000, Al Viro wrote: > 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> > --- Reviewed-by: Christian Brauner <brauner@kernel.org>
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c index 70236d1df3d3..793c005607cf 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -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;
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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)