lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251006212306.GK8084@frogsfrogsfrogs>
Date: Mon, 6 Oct 2025 14:23:06 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org
Subject: Re: [PATCH 05/12] fuse2fs: free global_fs after a failed
 ext2fs_close call

On Mon, Sep 15, 2025 at 03:39:01PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@...nel.org>
> 
> 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 fuseblk 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@...r.kernel.org> # v1.43.7
> Fixes: 6ae16a6814f47c ("misc: clean up error handling for ext2fs_run_ext3_journal()")
> Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
> ---
>  misc/fuse2fs.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
> index 4d92e1e818b1c4..08470a99dc7b4d 100644
> --- a/misc/fuse2fs.c
> +++ b/misc/fuse2fs.c
> @@ -4905,8 +4905,10 @@ int main(int argc, char *argv[])
>  	}
>  	if (global_fs) {
>  		err = ext2fs_close(global_fs);

Heh, this could have been ext2fs_close_free(&global_fs).  Will resubmit.

--D

> -		if (err)
> +		if (err) {
>  			com_err(argv[0], err, "while closing fs");
> +			ext2fs_free(global_fs);
> +		}
>  		global_fs = NULL;
>  	}
>  	if (fctx.lockfile) {
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ