[PATCH] scsi: qla2xxx: fix refcount leak in qla24xx_async_prli()
From: WenTao Liang
Date: Thu Jun 11 2026 - 07:13:49 EST
When qla24xx_async_prli() fails to start an SP, it jumps to the
done_free_sp error path and releases only the command kref via
kref_put. However, the vha reference count obtained earlier by
qla2x00_get_sp() through qla_vha_mark_busy() is never released on
this path, leading to a permanent leak of vha->vref_count.
Fix the leak by explicitly calling QLA_VHA_MARK_NOT_BUSY(vha) in
the error path before returning.
Cc: stable@xxxxxxxxxxxxxxx
Fixes: a5d42f4cffa5 ("scsi: qla2xxx: Add FC-NVMe port discovery and PRLI handling")
Signed-off-by: WenTao Liang <vulab@xxxxxxxxxxx>
---
drivers/scsi/qla2xxx/qla_init.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index e746c9274cde..8dd717dfcc14 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -1352,6 +1352,7 @@ qla24xx_async_prli(struct scsi_qla_host *vha, fc_port_t *fcport)
done_free_sp:
/* ref: INIT */
kref_put(&sp->cmd_kref, qla2x00_sp_release);
+ QLA_VHA_MARK_NOT_BUSY(vha);
fcport->flags &= ~FCF_ASYNC_SENT;
return rval;
}
--
2.50.1 (Apple Git-155)