Skip to content

Commit

Permalink
nvme: release namespace head reference on error
Browse files Browse the repository at this point in the history
commit ac26250 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 <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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
keithbusch authored and gregkh committed Mar 17, 2021
1 parent eb565f0 commit 4e2156c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/nvme/host/core.c
Expand Up @@ -3467,6 +3467,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;
}
}
Expand Down

0 comments on commit 4e2156c

Please sign in to comment.