From: "Lukáš Czerner" <lczerner@redhat.com>
To: Wei Yongjun <weiyj.lk@gmail.com>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
yongjun_wei@trendmicro.com.cn, linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: fix possible memory leak in ext4_remount()
Date: Wed, 27 Feb 2013 13:45:11 +0100 (CET) [thread overview]
Message-ID: <alpine.LFD.2.00.1302271343391.3310@localhost> (raw)
In-Reply-To: <CAPgLHd-J=j=aVCpjutq2B1+NMqxz=v50xNcEQA_57Ni_7v9HKA@mail.gmail.com>
On Wed, 27 Feb 2013, Wei Yongjun wrote:
> Date: Wed, 27 Feb 2013 13:18:53 +0800
> From: Wei Yongjun <weiyj.lk@gmail.com>
> To: tytso@mit.edu, adilger.kernel@dilger.ca
> Cc: yongjun_wei@trendmicro.com.cn, linux-ext4@vger.kernel.org
> Subject: [PATCH] ext4: fix possible memory leak in ext4_remount()
>
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> '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@redhat.com>
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> 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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2013-02-27 12:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-27 5:18 [PATCH] ext4: fix possible memory leak in ext4_remount() Wei Yongjun
2013-02-27 12:45 ` Lukáš Czerner [this message]
2013-03-02 22:13 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.1302271343391.3310@localhost \
--to=lczerner@redhat.com \
--cc=adilger.kernel@dilger.ca \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=weiyj.lk@gmail.com \
--cc=yongjun_wei@trendmicro.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).