nvmet-fc: release reference on target port
authorDaniel Wagner <dwagner@suse.de>
Wed, 31 Jan 2024 08:51:03 +0000 (09:51 +0100)
committerKeith Busch <kbusch@kernel.org>
Thu, 1 Feb 2024 15:44:46 +0000 (07:44 -0800)
In case we return early out of __nvmet_fc_finish_ls_req() we still have
to release the reference on the target port.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/target/fc.c

index 05e6a755b3306ed2666ebac88b5d75b773a3b222..3d53d9dc109950e962616dd90615dcfd469f48d8 100644 (file)
@@ -360,7 +360,7 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop)
 
        if (!lsop->req_queued) {
                spin_unlock_irqrestore(&tgtport->lock, flags);
-               return;
+               goto out_puttgtport;
        }
 
        list_del(&lsop->lsreq_list);
@@ -373,6 +373,7 @@ __nvmet_fc_finish_ls_req(struct nvmet_fc_ls_req_op *lsop)
                                  (lsreq->rqstlen + lsreq->rsplen),
                                  DMA_BIDIRECTIONAL);
 
+out_puttgtport:
        nvmet_fc_tgtport_put(tgtport);
 }