fuse: Destroy session on mount_fuse_export() fail

If mount_fuse_export() fails to mount the session, destroy it.
Depending on the allow_other configuration, fuse_export_create() may
retry this function on error, which may leak one session instance
otherwise.

Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Message-ID: <20260309150856.26800-7-hreitz@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Hanna Czenczek
2026-03-09 16:08:37 +01:00
committed by Kevin Wolf
parent 52d50658c3
commit b8b054690c

View File

@@ -270,11 +270,17 @@ static int mount_fuse_export(FuseExport *exp, Error **errp)
ret = fuse_session_mount(exp->fuse_session, exp->mountpoint);
if (ret < 0) {
error_setg(errp, "Failed to mount FUSE session to export");
return -EIO;
ret = -EIO;
goto fail;
}
exp->mounted = true;
return 0;
fail:
fuse_session_destroy(exp->fuse_session);
exp->fuse_session = NULL;
return ret;
}
/**