From: hch@infradead.org (Christoph Hellwig)
Subject: [PATCH] nvme-loop: kfree(ctrl) on _create() error exit
Date: Thu, 27 Oct 2016 05:49:06 -0700 [thread overview]
Message-ID: <20161027124906.GA28200@infradead.org> (raw)
In-Reply-To: <1477513257-30474-1-git-send-email-james_p_freyensee@linux.intel.com>
On Wed, Oct 26, 2016@01:20:57PM -0700, Jay Freyensee wrote:
> diff --git a/drivers/nvme/target/loop.c b/drivers/nvme/target/loop.c
> index d5df77d..b0f9931 100644
> --- a/drivers/nvme/target/loop.c
> +++ b/drivers/nvme/target/loop.c
> @@ -673,6 +673,7 @@ static struct nvme_ctrl *nvme_loop_create_ctrl(struct device *dev,
> nvme_uninit_ctrl(&ctrl->ctrl);
> out_put_ctrl:
> nvme_put_ctrl(&ctrl->ctrl);
> + kfree(ctrl);
> if (ret > 0)
> ret = -EIO;
> return ERR_PTR(ret);
This will give us a double free. The final put in nvme_put_ctrl calls
->free_ctrl which will free the controller.
next prev parent reply other threads:[~2016-10-27 12:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-26 20:20 [PATCH] nvme-loop: kfree(ctrl) on _create() error exit Jay Freyensee
2016-10-27 12:13 ` Sagi Grimberg
2016-10-27 12:49 ` Christoph Hellwig [this message]
2016-10-27 15:40 ` J Freyensee
2016-10-27 16:00 ` Christoph Hellwig
2016-10-30 6:48 ` Sagi Grimberg
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=20161027124906.GA28200@infradead.org \
--to=hch@infradead.org \
/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