From: Greg Kroah-Hartman <gre...@linuxfoundation.org>

From: Keith Busch <kbu...@kernel.org>

commit ac262508daa88fb12c5dc53cf30bde163f9f26c9 upstream.

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 <kbu...@kernel.org>
Reviewed-by: Sagi Grimberg <s...@grimberg.me>
Signed-off-by: Christoph Hellwig <h...@lst.de>
Signed-off-by: Jens Axboe <ax...@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/nvme/host/core.c |    1 +
 1 file changed, 1 insertion(+)

--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3467,6 +3467,7 @@ static int nvme_init_ns_head(struct nvme
                                "IDs don't match for shared namespace %d\n",
                                        nsid);
                        ret = -EINVAL;
+                       nvme_put_ns_head(head);
                        goto out_unlock;
                }
        }


Reply via email to