linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sagig@dev.mellanox.co.il (Sagi Grimberg)
Subject: [PATCH 7/8] nvmet: add a generic NVMe target
Date: Sun, 8 Nov 2015 12:26:04 +0200	[thread overview]
Message-ID: <563F233C.5000603@dev.mellanox.co.il> (raw)
In-Reply-To: <1446915643-21175-8-git-send-email-hch@lst.de>


> +void nvmet_ns_free(struct nvmet_ns *ns)
> +{
> +	struct nvmet_subsys *subsys = ns->subsys;
> +
> +	mutex_lock(&subsys->lock);
> +	if (!list_empty(&ns->dev_link))
> +		list_del_init(&ns->dev_link);
> +	mutex_unlock(&subsys->lock);
> +
> +	nvmet_put_namespace(ns);
> +}
> +
> +struct nvmet_ns *nvmet_ns_alloc(struct nvmet_subsys *subsys, u32 nsid)
> +{
> +	struct nvmet_ns *ns;
> +
> +	ns = kzalloc(sizeof(*ns), GFP_KERNEL);
> +	if (!ns)
> +		return NULL;
> +

This lacks also:
INIT_LIST_HEAD(&ns->dev_link);

So the list_empty() check in ns_free won't be bogus...
It causes a NULL deref on configfs rmdir.

> +	kref_init(&ns->ref);
> +	ns->nsid = nsid;
> +	ns->subsys = subsys;
> +	return ns;
> +}

  reply	other threads:[~2015-11-08 10:26 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-07 17:00 [RFC] generic NVMe target and NVMe loop driver Christoph Hellwig
2015-11-07 17:00 ` [PATCH 1/8] nvme: move set_queue_count to common code Christoph Hellwig
2015-11-07 17:00 ` [PATCH 2/8] nvme: move enable/disable/shutdown_ctrl " Christoph Hellwig
2015-11-08 16:39   ` Sagi Grimberg
2015-11-09 10:12     ` Christoph Hellwig
2015-11-07 17:00 ` [PATCH 3/8] nvme: move CC setup into nvme_enable_ctrl Christoph Hellwig
2015-11-07 17:00 ` [PATCH 4/8] nvme: move the timeout module paramters to common code Christoph Hellwig
2015-11-07 17:00 ` [PATCH 5/8] nvme: add segment limitations Christoph Hellwig
2015-11-07 17:00 ` [PATCH 6/8] nvme: export symbols needed for nvme-loop Christoph Hellwig
2015-11-07 17:00 ` [PATCH 7/8] nvmet: add a generic NVMe target Christoph Hellwig
2015-11-08 10:26   ` Sagi Grimberg [this message]
2015-11-08 13:57     ` Christoph Hellwig
2015-11-07 17:00 ` [PATCH 8/8] nvme-loop: add a NVMe loopback device Christoph Hellwig
2015-11-08 10:54   ` Sagi Grimberg
2015-11-08 13:22     ` Sagi Grimberg
2015-11-08 13:56       ` Christoph Hellwig
2015-11-15 19:18   ` Sagi Grimberg
2015-11-16  8:29     ` Christoph Hellwig
2015-11-16  9:35       ` Sagi Grimberg
2015-11-16  7:30 ` [RFC] generic NVMe target and NVMe loop driver Nicholas A. Bellinger
2015-11-16  8:08   ` Ming Lin
2015-11-16  8:29     ` Nicholas A. Bellinger
2015-11-17  5:53       ` Ming Lin
2015-11-16  8:32     ` 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=563F233C.5000603@dev.mellanox.co.il \
    --to=sagig@dev.mellanox.co.il \
    /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).