Skip to content

Commit 2c007ac

Browse files
ISCAS-Vulabmartinkpetersen
authored andcommitted
scsi: elx: efct: Fix refcount leak in efct_hw_io_abort()
When efct_hw_reqtag_alloc() fails in efct_hw_io_abort(), the error path returns -ENOSPC without releasing the reference obtained via kref_get_unless_zero() earlier in the function. All other error paths correctly drop the reference. This causes a permanent reference leak on the io_to_abort object. Additionally, the abort_in_progress flag is left set to true on this path, which means future abort attempts for the same I/O will immediately return -EINPROGRESS even though the abort was never submitted, effectively blocking recovery. Fix this by adding the missing kref_put() call and reset abort_in_progress to false, matching the cleanup done in the efct_hw_wq_write() failure path below. Cc: stable@vger.kernel.org Fixes: 63de513 ("scsi: elx: efct: Hardware I/O and SGL initialization") Signed-off-by: WenTao Liang <vulab@iscas.ac.cn> Reviewed-by: Daniel Wagner <dwagner@suse.de> Link: https://patch.msgid.link/20260611053037.63756-1-vulab@iscas.ac.cn Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 9cb2d52 commit 2c007ac

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/scsi/elx/efct/efct_hw.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,8 @@ efct_hw_io_abort(struct efct_hw *hw, struct efct_hw_io *io_to_abort,
19971997
wqcb = efct_hw_reqtag_alloc(hw, efct_hw_wq_process_abort, io_to_abort);
19981998
if (!wqcb) {
19991999
efc_log_err(hw->os, "can't allocate request tag\n");
2000+
io_to_abort->abort_in_progress = false;
2001+
kref_put(&io_to_abort->ref, io_to_abort->release);
20002002
return -ENOSPC;
20012003
}
20022004

0 commit comments

Comments
 (0)