[PATCH] fc: add a missing release get taken in nvmet_fc_alloc_target_assoc

amit.engel at dell.com amit.engel at dell.com
Mon Jan 23 04:37:28 PST 2023


From: Amit Engel <Amit.Engel at dell.com>

As part of nvmet_fc_ls_create_association there is a case where
nvmet_fc_alloc_target_queue fails right after a new
association with admin queue is created.
In this case, no one releases the get taken in nvmet_fc_alloc_target_assoc
This fix is adding the missing get release

Signed-off-by: Amit Engel <Amit.Engel at dell.com>
---
 drivers/nvme/target/fc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/fc.c b/drivers/nvme/target/fc.c
index ab2627e17bb9..1ab6601fdd5c 100644
--- a/drivers/nvme/target/fc.c
+++ b/drivers/nvme/target/fc.c
@@ -1685,8 +1685,10 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport,
 		else {
 			queue = nvmet_fc_alloc_target_queue(iod->assoc, 0,
 					be16_to_cpu(rqst->assoc_cmd.sqsize));
-			if (!queue)
+			if (!queue) {
 				ret = VERR_QUEUE_ALLOC_FAIL;
+				nvmet_fc_tgt_a_put(iod->assoc);
+			}
 		}
 	}
 
-- 
2.31.1




More information about the Linux-nvme mailing list