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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111006142220.GA19049@thunk.org>
Date:	Thu, 6 Oct 2011 10:22:20 -0400
From:	Ted Ts'o <tytso@....edu>
To:	Tao Ma <tm@....ma>
Cc:	linux-ext4@...r.kernel.org
Subject: Re: [PATCH] ext4: Free resources in the error path of ext4_mb_init.

On Fri, Aug 19, 2011 at 11:28:08PM +0800, Tao Ma wrote:
> From: Tao Ma <boyu.mt@...bao.com>
> 
> In commit 79a77c5ac, we move ext4_mb_init_backend after the allocation
> of s_locality_group to avoid memory leak in error path, but there are
> still some other error paths in ext4_mb_init that need to do the same
> work. So this patch adds all the error patch for ext4_mb_init. And all
> the pointers are reset to NULL in case the caller may double free them.
> 
> Signed-off-by: Tao Ma <boyu.mt@...bao.com>

but I had to reorder the cleanup code for
"out_free_groupinfo_slab" and "out_free_locality_groups" in the
following patch hunk....


> @@ -2513,11 +2512,19 @@ int ext4_mb_init(struct super_block *sb, int needs_recovery)
>  
>  	if (sbi->s_journal)
>  		sbi->s_journal->j_commit_callback = release_blocks_on_commit;
> +
> +	return 0;
> +
> +out_free_groupinfo_slab:
> +	ext4_groupinfo_destroy_slabs();
> +out_free_locality_groups:
> +	free_percpu(sbi->s_locality_groups);
> +	sbi->s_locality_groups = NULL;

Since we first allocate the groupinfo slabs, and then the locality
groups, so the cleanup paths need to do things in the opposite
order.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ