]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
fuse2fs: free global_fs after a failed ext2fs_close call
authorDarrick J. Wong <djwong@kernel.org>
Tue, 2 Sep 2025 18:02:43 +0000 (11:02 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 17 Oct 2025 23:34:21 +0000 (16:34 -0700)
commitc8088d9e492f0a72bcd591d78bc99a8721f9fe5b
tree0a772cc119ebce1a4fe32d926ea2510d368cf0b8
parent6dbb5d794f1762abff4909bbf3bcf43ddb3780f0
fuse2fs: free global_fs after a failed ext2fs_close call

If ext2fs_close fails for any reason, it won't free the ext2_filsys
object or any of the other things that hang off of it, like the io
managers and whatnot.  Right now this results in a memory leak of
global_fs, which is mostly benign because we're nearly to the end of
main() anyway.

However, a future patch will move the ext2fs_close call to op_destroy
prior to introducing iomap support, which means that we won't close
the (O_EXCL) block device before returning from umount, which will cause
problems with fstests and the user expectation that block devices are
closed when umount(8) returns.

Therefore, free the context after a failed close.

Cc: <linux-ext4@vger.kernel.org> # v1.43.7
Fixes: 6ae16a6814f47c ("misc: clean up error handling for ext2fs_run_ext3_journal()")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
misc/fuse2fs.c