summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIsrael Rukshin <israelr@mellanox.com>2017-11-13 12:29:40 +0000
committerChristoph Hellwig <hch@lst.de>2018-01-08 11:01:58 +0100
commiteca19dc1d84d924544dda0c8d2fd4bb4131affeb (patch)
tree864d1e994c74c5014b845320ad099cbcc377048e /drivers
parent6fbcde6691b514faa963c60f5537332530f1bf0a (diff)
nvmet: fix error flow in nvmet_alloc_ctrl()
Remove the allocated id on error. Signed-off-by: Israel Rukshin <israelr@mellanox.com> Reviewed-by: Max Gurtovoy <maxg@mellanox.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/target/core.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index b54748ad5f48..07eb45d32a7a 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -830,7 +830,7 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
/* Don't accept keep-alive timeout for discovery controllers */
if (kato) {
status = NVME_SC_INVALID_FIELD | NVME_SC_DNR;
- goto out_free_sqs;
+ goto out_remove_ida;
}
/*
@@ -860,6 +860,8 @@ u16 nvmet_alloc_ctrl(const char *subsysnqn, const char *hostnqn,
*ctrlp = ctrl;
return 0;
+out_remove_ida:
+ ida_simple_remove(&cntlid_ida, ctrl->cntlid);
out_free_sqs:
kfree(ctrl->sqs);
out_free_cqs: