From: Keith Busch Date: Thu, 9 Apr 2020 16:09:00 +0000 (-0700) Subject: nvme: release namespace head reference on error X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ac262508daa88fb12c5dc53cf30bde163f9f26c9;p=linux.git 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 Reviewed-by: Sagi Grimberg Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 15b9e60be2043..f2dc89dd2e1c4 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; } }