Re: [PATCH v2 1/5] scsi: elx: efct: check the HW state before allocating an HIO

[email protected] Thu, 06 Aug 2026 20:59:57 +0000
Newsgroups gmane.linux.scsi
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Pre-existing resource leak of `hio` (Hardware I/O object) in `efct_hw_bls_send()` when WQE formatting fails.
--

--- Patch [1]: [PATCH v2 1/5] scsi: elx: efct: check the HW state before allocating an HIO ---
commit dc19c507aa2788a2b5120f2a9e8e09430d14b440
Author: Ali Ahmet Memis <[email protected]>

scsi: elx: efct: check the HW state before allocating an HIO

efct_els_hw_srrs_send() takes an HIO from the pool and only then looks at
hw->state, returning without giving it back when the HW is not active. This
commit fixes the issue by moving the state check before allocating the HIO.

> Check the state first, the way efct_hw_bls_send() already does.

[Severity: High]
This is a pre-existing issue, but while efct_hw_bls_send() correctly checks
the state first, does it still have a resource leak when WQE formatting fails?

In efct_hw_bls_send(), an HIO is allocated via efct_hw_io_alloc(). If the
subsequent call to sli_xmit_bls_rsp64_wqe() fails, it returns -EIO directly
without releasing hio back to the free list:

drivers/scsi/elx/efct/efct_hw.c:efct_hw_bls_send() {
...
	hio = efct_hw_io_alloc(hw);
...
	if (sli_xmit_bls_rsp64_wqe(&hw->sli, hio->wqe.wqebuf,
				   &bls, bls_params)) {
		efc_log_err(hw->os, "XMIT_BLS_RSP64 WQE error\n");
		return -EIO;
	}
...
}

Should this call efct_hw_io_free(hw, hio) before returning -EIO? Once the
pool is exhausted, efct_hw_io_alloc() will permanently fail.

-- 
Sashiko AI review ยท https://sashiko.dev/#/patchset/[email protected]?part=1