Re: [PATCH] ext4: fix possible memory leak in ext4_remount()

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

 



On Wed, 27 Feb 2013, Wei Yongjun wrote:

> Date: Wed, 27 Feb 2013 13:18:53 +0800
> From: Wei Yongjun <weiyj.lk@xxxxxxxxx>
> To: tytso@xxxxxxx, adilger.kernel@xxxxxxxxx
> Cc: yongjun_wei@xxxxxxxxxxxxxxxxx, linux-ext4@xxxxxxxxxxxxxxx
> Subject: [PATCH] ext4: fix possible memory leak in ext4_remount()
> 
> From: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> 
> 'orig_data' is malloced in ext4_remount() and should be freed
> before leaving from the error handling cases, otherwise it will
> cause memory leak.

Good catch, thanks!

Reviewed-by: Lukas Czerner <lczerner@xxxxxxxxxx>

> 
> Signed-off-by: Wei Yongjun <yongjun_wei@xxxxxxxxxxxxxxxxx>
> ---
>  fs/ext4/super.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 373d46c..8ae09e3 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4538,6 +4538,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
>  			if (!old_opts.s_qf_names[i]) {
>  				for (j = 0; j < i; j++)
>  					kfree(old_opts.s_qf_names[j]);
> +				kfree(orig_data);
>  				return -ENOMEM;
>  			}
>  		} else
> 
> 
> --
> 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
> 
--
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