summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/host
diff options
context:
space:
mode:
authorKeith Busch <kbusch@kernel.org>2020-04-09 18:09:00 +0200
committerJens Axboe <axboe@kernel.dk>2020-05-10 00:18:35 +0200
commitac262508daa88fb12c5dc53cf30bde163f9f26c9 (patch)
tree33953a2a563303dc834c7ee3a392aa7db3314373 /drivers/nvme/host
parentnvme: unlink head after removing last namespace (diff)
downloadlinux-ac262508daa88fb12c5dc53cf30bde163f9f26c9.tar.xz
linux-ac262508daa88fb12c5dc53cf30bde163f9f26c9.zip
nvme: release namespace head reference on error
If a namespace identification does not match the subsystem's head for that NSID, release the reference that was taken when the matching head was initially found. Signed-off-by: Keith Busch <kbusch@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/nvme/host')
-rw-r--r--drivers/nvme/host/core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 15b9e60be204..f2dc89dd2e1c 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3503,6 +3503,7 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid,
"IDs don't match for shared namespace %d\n",
nsid);
ret = -EINVAL;
+ nvme_put_ns_head(head);
goto out_unlock;
}
}