[PATCH] scsi: elx: efct: fix IO refcount leak in efct_hw_io_abort()

Wentao Liang <[email protected]> Wed, 27 May 2026 10:09:35 +0000
Newsgroups org.kernel.vger.target-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-scsi,org.kernel.vger.stable
Message-ID <[email protected]>
efct_hw_io_abort() calls efct_hw_io_alloc() which initializes the IO
reference counter to 1. On the error path where the abort operation
fails after IO allocation, the function returns without calling
kref_put() to release the IO reference, leaking the refcount.

Add kref_put() on the error path to properly release the reference.

Fixes: 63de51327a64 ("scsi: elx: efct: Hardware I/O and SGL initialization")
Cc: [email protected]
Signed-off-by: Wentao Liang <[email protected]>
---
 drivers/scsi/elx/efct/efct_hw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_hw.c
index 1838032f6486..4ecd6f4165f4 100644
--- a/drivers/scsi/elx/efct/efct_hw.c
+++ b/drivers/scsi/elx/efct/efct_hw.c
@@ -1997,6 +1997,7 @@ efct_hw_io_abort(struct efct_hw *hw, struct efct_hw_io *io_to_abort,
 	wqcb = efct_hw_reqtag_alloc(hw, efct_hw_wq_process_abort, io_to_abort);
 	if (!wqcb) {
 		efc_log_err(hw->os, "can't allocate request tag\n");
+		kref_put(&io_to_abort->ref, io_to_abort->release);
 		return -ENOSPC;
 	}
 
-- 
2.34.1