Skip to contentSkip to conversation

fc: add a missing release get taken in nvmet_fc_alloc_target_assoc

PATCH Applied [email protected] 3 participants 3 messages Jan 23, 2023 – Feb 1, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fc: add a missing release get taken in nvmet_fc_alloc_target_assoc

From: Amit Engel <[email protected]>

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

---
 drivers/nvme/target/fc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/target/fc.c +3 -1
index ab2627e17bb9..1ab6601fdd5c 100644
@@ -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);
+			}
 		}
 	}
 
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 19 lines · On 1/23/2023 4:37 AM, [email protected] wrote:

From: Amit Engel <[email protected]>

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

---
  drivers/nvme/target/fc.c | 4 +++-
  1 file changed, 3 insertions(+), 1 deletion(-)
drivers/nvme/target/fc.c +0 -0
index ab2627e17bb9..1ab6601fdd5c 100644
@@ -1685,8 +1685,10 @@ nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport,
  		else {

drivers/nvme/target/fc.c nvmet_fc_ls_create_association(struct nvmet_fc_tgtport *tgtport, · line 1694

Quoted 10 lines
drivers/nvme/target/fc.c +3 -1
  			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);
+			}
  		}
  	}
 

looks good

-- james