[PATCH] scsi: qla2xxx: Fix cs84xx reference leak in qla2x00_initialize_adapter()
From: Wentao Liang
Date: Thu Sep 17 2026 - 11:58:33 EST
qla84xx_get_chip() takes a reference on the shared 84xx chip state, but
the early return taken when qla2x00_init_rings() fails does not release
it. The reference is only dropped on the 84xx init failure and on
driver removal, which never runs after a failed probe, so the chip
state is leaked.
Drop the reference before returning on this error path.
Fixes: 26a77799195f ("scsi: qla2xxx: Correct error handling during initialization failures")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/scsi/qla2xxx/qla_init.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index e746c9274cde..b5bffe561735 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2853,8 +2853,11 @@ qla2x00_initialize_adapter(scsi_qla_host_t *vha)
rval = qla2x00_init_rings(vha);
/* No point in continuing if firmware initialization failed. */
- if (rval != QLA_SUCCESS)
+ if (rval != QLA_SUCCESS) {
+ if (IS_QLA84XX(ha))
+ qla84xx_put_chip(vha);
return rval;
+ }
ha->flags.chip_reset_done = 1;
--
2.34.1