From: cgxu519 <cgxu519@gmx.com>
To: ooo@electrozaur.com
Cc: linux-kernel@vger.kernel.org, cgxu519@gmx.com
Subject: Re: [PATCH 1/2] fs/exofs: fix potential memory leak in mount option parsing
Date: Thu, 21 Jun 2018 10:14:47 +0800 [thread overview]
Message-ID: <38b17aef-db48-0258-3086-206659d2da85@gmx.com> (raw)
In-Reply-To: <1528862714-78150-1-git-send-email-cgxu519@gmx.com>
Hi Boaz,
Could you have a look at this trivial patch?
Thanks,
Chengguang.
On 06/13/2018 12:05 PM, Chengguang Xu wrote:
> There are some cases can cause memory leak when parsing
> option 'osdname'.
>
> Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
> ---
> fs/exofs/super.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/fs/exofs/super.c b/fs/exofs/super.c
> index 719a315..f3e17a9 100644
> --- a/fs/exofs/super.c
> +++ b/fs/exofs/super.c
> @@ -101,6 +101,7 @@ static int parse_options(char *options, struct exofs_mountopt *opts)
> token = match_token(p, tokens, args);
> switch (token) {
> case Opt_name:
> + kfree(opts->dev_name);
> opts->dev_name = match_strdup(&args[0]);
> if (unlikely(!opts->dev_name)) {
> EXOFS_ERR("Error allocating dev_name");
> @@ -867,8 +868,10 @@ static struct dentry *exofs_mount(struct file_system_type *type,
> int ret;
>
> ret = parse_options(data, &opts);
> - if (ret)
> + if (ret) {
> + kfree(opts.dev_name);
> return ERR_PTR(ret);
> + }
>
> if (!opts.dev_name)
> opts.dev_name = dev_name;
prev parent reply other threads:[~2018-06-21 2:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-13 4:05 Chengguang Xu
2018-06-13 4:05 ` [PATCH 2/2] fs/exofs: only use true/false for asignment of bool type variable Chengguang Xu
2018-06-21 2:14 ` cgxu519 [this message]
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=38b17aef-db48-0258-3086-206659d2da85@gmx.com \
--to=cgxu519@gmx.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ooo@electrozaur.com \
/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
all inboxes | Powered by JetHome®