Re: [PATCH] ext4: memory leakage in ext4_mb_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 21, 2010 at 10:01:06PM +0800, jing zhang wrote:
> From: Jing Zhang <zj.barak@xxxxxxxxx>
> 
> Date: Sun Mar 21 21:59:35     2010
> 
> Cc: Theodore Ts'o <tytso@xxxxxxx>
> Cc: Andreas Dilger <adilger@xxxxxxx>
> Cc: Dave Kleikamp <shaggy@xxxxxxxxxxxxxxxxxx>
> Signed-off-by: Jing Zhang <zj.barak@xxxxxxxxx>
> 
> ---
> 
> --- linux-2.6.32/fs/ext4/mballoc.c	2009-12-03 11:51:22.000000000 +0800
> +++ ext4_mm_leak/mballoc3.c	2010-03-21 21:37:18.000000000 +0800
> @@ -2360,6 +2360,24 @@ err_freesgi:
>  	return -ENOMEM;
>  }
> 
> +static void ext4_mb_destroy_backend(struct super_block *sb)
> +{
> +	ext4_group_t ngroups = ext4_get_groups_count(sb);
> +	ext4_group_t i;
> +	struct ext4_sb_info *sbi = EXT4_SB(sb);
> +	int j;
> +	int num_meta_group_infos = (ngroups + EXT4_DESC_PER_BLOCK(sb) -1)
> +					>> EXT4_DESC_PER_BLOCK_BITS(sb);
> +	for (i = 0; i < ngroups; i++)
> +		kfree(ext4_get_group_info(sb, i));
> +
> +	for (j = 0; j < num_meta_group_infos; j++)
> +		kfree(sbi->s_group_info[j]);
> +
> +	kfree(sbi->s_group_info);
> +	iput(sbi->s_buddy_cache);
> +}
> +

It would be better if this could be done by making ext4_mb_release()
more flexible, and then calling ext4_mb_release() if there is an error
setting up the data structures in ext4_mb_init().

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

[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux