]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nvmet-fc: put ref when assoc->del_work is already scheduled
authorDaniel Wagner <wagi@kernel.org>
Tue, 8 Apr 2025 15:29:10 +0000 (17:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 2 May 2025 05:51:00 +0000 (07:51 +0200)
[ Upstream commit 70289ae5cac4d3a39575405aaf63330486cea030 ]

Do not leak the tgtport reference when the work is already scheduled.

Signed-off-by: Daniel Wagner <wagi@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/target/fc.c

index 68ff9540e2d1310f2045e9f10462086e1f819de5..570c58d2b5a58532fb55a03031d90b43d163c0d2 100644 (file)
@@ -1091,7 +1091,8 @@ static void
 nvmet_fc_schedule_delete_assoc(struct nvmet_fc_tgt_assoc *assoc)
 {
        nvmet_fc_tgtport_get(assoc->tgtport);
-       queue_work(nvmet_wq, &assoc->del_work);
+       if (!queue_work(nvmet_wq, &assoc->del_work))
+               nvmet_fc_tgtport_put(assoc->tgtport);
 }
 
 static struct nvmet_fc_tgt_assoc *