From: Max Gurtovoy <maxg@mellanox.com>
To: Johannes Thumshirn <jthumshirn@suse.de>, Christoph Hellwig <hch@lst.de>
Cc: Roland Dreier <roland@purestorage.com>,
Sagi Grimberg <sagi@grimberg.me>,
Linux Kernel Mailinglist <linux-kernel@vger.kernel.org>,
"Linux NVMe Mailinglist" <linux-nvme@lists.infradead.org>,
Keith Busch <keith.busch@intel.com>,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] nvme: don't free uuid pointer before printing it
Date: Thu, 25 Jan 2018 11:37:33 +0200 [thread overview]
Message-ID: <cad484e2-4d21-185d-4b28-fb9be12591d5@mellanox.com> (raw)
In-Reply-To: <20180125080925.6019-1-jthumshirn@suse.de>
On 1/25/2018 10:09 AM, Johannes Thumshirn wrote:
> Commit df351ef73789 ("nvme-fabrics: fix memory leak when parsing host ID
> option") fixed the leak of 'p' but in case uuid_parse() fails the memory
> is freed before the error print that is using it.
>
> Free it after printing eventual errors.
>
> Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
> Fixes: df351ef73789 ("nvme-fabrics: fix memory leak when parsing host ID option")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Cc: Roland Dreier <roland@purestorage.com>
> ---
> drivers/nvme/host/fabrics.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index eb46967bb0d5..9cee72a80472 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -739,12 +739,13 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
> goto out;
> }
> ret = uuid_parse(p, &hostid);
> - kfree(p);
> if (ret) {
> pr_err("Invalid hostid %s\n", p);
> ret = -EINVAL;
> + kfree(p);
> goto out;
> }
> + kfree(p);
> break;
> case NVMF_OPT_DUP_CONNECT:
> opts->duplicate_connect = true;
>
Looks good,
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
next prev parent reply other threads:[~2018-01-25 9:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-25 8:09 Johannes Thumshirn
2018-01-25 9:37 ` Max Gurtovoy [this message]
2018-01-25 15:20 ` Christoph Hellwig
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=cad484e2-4d21-185d-4b28-fb9be12591d5@mellanox.com \
--to=maxg@mellanox.com \
--cc=dan.carpenter@oracle.com \
--cc=hch@lst.de \
--cc=jthumshirn@suse.de \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=roland@purestorage.com \
--cc=sagi@grimberg.me \
/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®