[PATCH v4 1/5] fuse: Fix leak in fuse_dentry_automount() error path

From: Greg Kurz
Date: Thu May 20 2021 - 11:47:20 EST


Some rollback was forgotten during the addition of crossmounts.

Fixes: bf109c64040f ("fuse: implement crossmounts")
Cc: mreitz@xxxxxxxxxx
Signed-off-by: Greg Kurz <groug@xxxxxxxx>
---
fs/fuse/dir.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 1b6c001a7dd1..fb2af70596c3 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -339,8 +339,11 @@ static struct vfsmount *fuse_dentry_automount(struct path *path)

/* Initialize superblock, making @mp_fi its root */
err = fuse_fill_super_submount(sb, mp_fi);
- if (err)
+ if (err) {
+ fuse_conn_put(fc);
+ kfree(fm);
goto out_put_sb;
+ }

sb->s_flags |= SB_ACTIVE;
fsc->root = dget(sb->s_root);
--
2.26.3