From: sagi@grimberg.me (Sagi Grimberg)
Subject: [PATCH v3 2/3] nvme: put ns_head ref if namespace fails allocation
Date: Mon, 11 Mar 2019 14:16:07 -0700 [thread overview]
Message-ID: <20190311211608.16628-3-sagi@grimberg.me> (raw)
In-Reply-To: <20190311211608.16628-1-sagi@grimberg.me>
In case nvme_alloc_ns fails after we initialize ns_head but before we
add the ns to the controller namespaces list we need to explicitly put
the ns_head reference because when we teardown the controller we
won't find it, causing us to leak a dangling subsystem eventually.
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
drivers/nvme/host/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 751e14468c0e..5707ad6d987a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3319,6 +3319,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid)
mutex_lock(&ctrl->subsys->lock);
list_del_rcu(&ns->siblings);
mutex_unlock(&ctrl->subsys->lock);
+ nvme_put_ns_head(ns->head);
out_free_id:
kfree(id);
out_free_queue:
--
2.17.1
next prev parent reply other threads:[~2019-03-11 21:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 21:16 [PATCH v3 0/3] Couple of fixes detected with blktests Sagi Grimberg
2019-03-11 21:16 ` [PATCH v3 1/3] nvme: fail namespace revalidate if block size exceeds PAGE_SIZE Sagi Grimberg
2019-03-11 21:21 ` Keith Busch
2019-03-11 22:02 ` Sagi Grimberg
2019-03-11 22:05 ` Keith Busch
2019-03-11 21:16 ` Sagi Grimberg [this message]
2019-03-11 21:16 ` [PATCH v3 3/3] nvmet-file: clamp-down file namespace lba_shift 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=20190311211608.16628-3-sagi@grimberg.me \
--to=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