From: Darrick J. Wong Date: Wed, 11 Jun 2025 16:44:01 +0000 (-0700) Subject: fuse2fs: fix error bailout in op_create X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=9f6d1bf3bbf16cef4a08b67894c827059dd401a8;p=tools%2Fe2fsprogs.git fuse2fs: fix error bailout in op_create Tim Woodall pointed out that op_create returns garbage error codes if the ext2fs_extent_open2 in op_create fails. Worse than that, it also neglects to drop the bfl and leaks temp_path. Let's fix all that. Cc: linux-ext4@vger.kernel.org # v1.43 Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs") Reported-by: Tim Woodall Signed-off-by: Darrick J. Wong Signed-off-by: Theodore Ts'o --- diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c index 97b1c5b..d889bda 100644 --- a/misc/fuse2fs.c +++ b/misc/fuse2fs.c @@ -3307,8 +3307,11 @@ static int op_create(const char *path, mode_t mode, struct fuse_file_info *fp) inode.i_flags &= ~EXT4_EXTENTS_FL; ret = ext2fs_extent_open2(fs, child, EXT2_INODE(&inode), &handle); - if (ret) - return ret; + if (ret) { + ret = translate_error(fs, child, err); + goto out2; + } + ext2fs_extent_free(handle); }