From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC30B4C77C7; Thu, 6 Aug 2026 19:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044263; cv=pass; b=Tz87MdmUvYv73i4O2zFG4NL4nx1Z6C0t3u+eFkh0BMMKtDW76+YoWZddePj1xe9jCLriJC7XFMsyABXVB+SH7MypYsY8duhj7klvgegWVLWuvlPk/oK+0yFZe6mfRBzkYiWzzQrgTpPFAr2Zn/F0YMVTdAOYzk/tM8UElS41mrw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044263; c=relaxed/simple; bh=eqM1ZPk/agcGMPcX21oUna0q3FO6SByOSOwQ/zPnPJE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZqeBCdrWwTC/Nxmx2yuYjri+xFCsrNGksPrHkZa9MfZ5+3kZA0KpXwvj/0wZrEA/7or+kIo2fKoq7aEn1CjhVy165pO4kiKRgp34L+AMvva6tqrhCaTR46U+jJX9/H63VlvjqIWeY4N5d1ZwYI8CfWReHv/YsUQDaXR91moQ20g= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=XseFah/L; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="XseFah/L" ARC-Seal: i=1; a=rsa-sha256; t=1786044241; cv=none; d=zohomail.eu; s=zohoarc; b=HlR3vDANS8lmY72SGzX2i0i6muFtXoigjwZYsmR/JuJFedwep8XXUouHznZr7nL44xz5+9ayCvHK7jbmPmZzRvphzY0ENPdxjZ+eDfuqz0UotLnRssHywj3lJbVVWvkp/cLfEnyRBKpBdlSvpw9+uoeNVQ3MwlpxioHQR8LTMtY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786044241; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=EVZALisAIx7+fM/EWmicZYXYhpwiY2efmt9ZHcLNV9I=; b=Qj9IvCsSJmoxmZ3cW+ozZoIrh2Ql/RpehSonZGdJLqhp1wdkhqumK+gpNn4WLy6M2p7CxK9R5YxON1mDogIyynW0uQjrJRkv/lOJ1BazD/8pFEljyCelHmw7hvWsa8dgjKLsZL/n9tgE14olQpnvusrWrywvMOg5AC+e9BvY4cU= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786044241; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=EVZALisAIx7+fM/EWmicZYXYhpwiY2efmt9ZHcLNV9I=; b=XseFah/La2pWunFz+XzCYxdVgrs755k3OcWszQ5a4mfeUFcIDstWQ8RMEEi+oldb +9RVuPWcOsXG+rRltiEJztpdvlprUWMBEAAjOG6fOVDnKwhYDf/osVhCJyaxpDd62s5 aDdK6olXroWPfNqX/uwlafV88HsqclgnvUjbTT/k= Received: by mx.zoho.eu with SMTPS id 1786044239264751.5100185771277; Thu, 6 Aug 2026 21:23:59 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] scsi: elx: efct: check the HW state before allocating an HIO Date: Thu, 6 Aug 2026 19:23:41 +0000 Message-ID: <20260806192345.328621-2-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" 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: hio =3D efct_hw_io_alloc(hw); if (!hio) { pr_err("HIO alloc failed\n"); return -EIO; } if (hw->state !=3D EFCT_HW_STATE_ACTIVE) { efc_log_debug(hw->os, "cannot send SRRS, HW state=3D%d\n", hw->state); return -EIO; } _efct_hw_io_alloc() moves the entry from hw->io_free to hw->io_inuse and initialises its reference, and the only thing that puts it back is the completion of a submitted WQE. Nothing is submitted here, so the entry stays on hw->io_inuse for the lifetime of the adapter. The memory is reclaimed in efct_hw_teardown(), which frees hw->io[] as a whole, but the pool loses one usable entry for every ELS or CT send that takes this path. Once it is empty efct_hw_io_alloc() starts failing and no further ELS or CT traffic can be sent. Check the state first, the way efct_hw_bls_send() already does. Fixes: dd53d333aadb ("scsi: elx: efct: Hardware I/O submission routines") Signed-off-by: Ali Ahmet Memis --- drivers/scsi/elx/efct/efct_hw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_h= w.c index b79c6a7ea791..15c37ff1d52e 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -2706,18 +2706,18 @@ efct_els_hw_srrs_send(struct efc *efc, struct efc_d= isc_io *io) u32 sge0_flags; u32 sge1_flags; =20 - hio =3D efct_hw_io_alloc(hw); - if (!hio) { - pr_err("HIO alloc failed\n"); - return -EIO; - } - if (hw->state !=3D EFCT_HW_STATE_ACTIVE) { efc_log_debug(hw->os, "cannot send SRRS, HW state=3D%d\n", hw->state); return -EIO; } =20 + hio =3D efct_hw_io_alloc(hw); + if (!hio) { + pr_err("HIO alloc failed\n"); + return -EIO; + } + hio->done =3D efct_els_ssrs_send_cb; hio->arg =3D io; =20 --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A51762D8364; Thu, 6 Aug 2026 20:23:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047832; cv=pass; b=iXkEPLHWQwyj2X7tnGfd6JHr2bDaPsc2diilZZXuoQGDbTI476zhv7JF5WHcazhSrFbZ5SgQK8UqOwaubr6sDbxEjhfVTqQi4OkYiy4pzBzeE2TEBxxlKgDsQxsdNIAKAZa8+cx6h9RuhkUb+lKapBVNx4szr47Ba8hulsik5A0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047832; c=relaxed/simple; bh=eqM1ZPk/agcGMPcX21oUna0q3FO6SByOSOwQ/zPnPJE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HBhNFRJAynF72hiYxVOWBRClWuAWDW2IV4dkogcDrbzKryoMCphAfFawRrGfWxQPx5zsEgQ4EmuELEl+LxAnsxak3nnTseeKuNIIaS3TtuOUPkwcF6PABs0gX3U3Owo98bQrO27np/o3a6H5ar2UpfK3tlwSgImKj9pMAPC6yEQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=DPCdSgKG; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="DPCdSgKG" ARC-Seal: i=1; a=rsa-sha256; t=1786047815; cv=none; d=zohomail.eu; s=zohoarc; b=eKPAsRGmL2b4mEhfJHOa1giTMNizgc7POauGiYg5K7Fvwub7DgQSWP/ifXBGM1r8C9gni4uWL40xbhmJvoMTB3e7In6YQWfdKqt0ra3NoxwqwrPJvCvM1BJVRl4opXXX7cWFqh8ZCHkqL77EMVMWCRsp8pBUR2gjO3m0OUNReBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786047815; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=EVZALisAIx7+fM/EWmicZYXYhpwiY2efmt9ZHcLNV9I=; b=QU4n/e0IiaTU3TF61LqihvLZmiIijJr5Z3Kxu6MkHLNtGTrYaPHop/Y6rki410ItbUYJq3EI2xiSHUOgg1wpGd1uyac2AUg4/r1SW1KCXX4VwQtI45f+5YRCsY8um5yPImZLbtmFixc9RQMabjXlmQ+ol44fXFC7eRf+8KKzx/Q= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786047815; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=EVZALisAIx7+fM/EWmicZYXYhpwiY2efmt9ZHcLNV9I=; b=DPCdSgKG9CkDeAT3l8JIQmCPHUKGk7pRD4SjacWcUVSe5KWe48XTZ2EEpp1VzII6 CWeNTgdVz2NA35Bng8CWGnvKdwzsWIOXeCys1TQ4L96uk2WRwiKEre44qCJx1aOpEPD GW9RL+4UFnHXKaxM7lnAiehOGl9x+7EGKIMtEp5U= Received: by mx.zoho.eu with SMTPS id 1786047812511122.76407732708913; Thu, 6 Aug 2026 22:23:32 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] scsi: elx: efct: check the HW state before allocating an HIO Date: Thu, 6 Aug 2026 20:22:01 +0000 Message-ID: <20260806202205.345326-2-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" 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: hio =3D efct_hw_io_alloc(hw); if (!hio) { pr_err("HIO alloc failed\n"); return -EIO; } if (hw->state !=3D EFCT_HW_STATE_ACTIVE) { efc_log_debug(hw->os, "cannot send SRRS, HW state=3D%d\n", hw->state); return -EIO; } _efct_hw_io_alloc() moves the entry from hw->io_free to hw->io_inuse and initialises its reference, and the only thing that puts it back is the completion of a submitted WQE. Nothing is submitted here, so the entry stays on hw->io_inuse for the lifetime of the adapter. The memory is reclaimed in efct_hw_teardown(), which frees hw->io[] as a whole, but the pool loses one usable entry for every ELS or CT send that takes this path. Once it is empty efct_hw_io_alloc() starts failing and no further ELS or CT traffic can be sent. Check the state first, the way efct_hw_bls_send() already does. Fixes: dd53d333aadb ("scsi: elx: efct: Hardware I/O submission routines") Signed-off-by: Ali Ahmet Memis --- drivers/scsi/elx/efct/efct_hw.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_h= w.c index b79c6a7ea791..15c37ff1d52e 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -2706,18 +2706,18 @@ efct_els_hw_srrs_send(struct efc *efc, struct efc_d= isc_io *io) u32 sge0_flags; u32 sge1_flags; =20 - hio =3D efct_hw_io_alloc(hw); - if (!hio) { - pr_err("HIO alloc failed\n"); - return -EIO; - } - if (hw->state !=3D EFCT_HW_STATE_ACTIVE) { efc_log_debug(hw->os, "cannot send SRRS, HW state=3D%d\n", hw->state); return -EIO; } =20 + hio =3D efct_hw_io_alloc(hw); + if (!hio) { + pr_err("HIO alloc failed\n"); + return -EIO; + } + hio->done =3D efct_els_ssrs_send_cb; hio->arg =3D io; =20 --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CD634D2EC5; Thu, 6 Aug 2026 19:24:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044263; cv=pass; b=URZpu10YRe6Wrwz9OV44FR3W3BNeyDy8EmWQf1zGFSZejxosMkDL+Q0vVTUPE75eqjwTZK/3XLs4zwAKhHznhURY/V3V35/51m+Azk6CWaSP59xfKBq+X4HNQHzm2i11yFD36c571z4UU4mbdQiHH2e1F5cZGUQahab2Z3EjVsw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044263; c=relaxed/simple; bh=wnKu+FgPijdgZ7wQCNpgJJnUvujcvv4NLraMqraCZiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kcp5YcSHX3BwDY6yAjoI8e/wv8w6IFTz2oNR+ETie7nYH1UJ+2Y13rZpGhH77soRmoB/RK5Bt/dHjZddx4J2CN5iehdXsZ13QVOQu+CBLXlX14mYOAQP1v8bWPfxZ2U0LYU+BCSxrRNUrpo/YQ0kTQ0hsWLVCHg/LCahiJUcn78= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=ocA97hgn; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="ocA97hgn" ARC-Seal: i=1; a=rsa-sha256; t=1786044241; cv=none; d=zohomail.eu; s=zohoarc; b=I1ygPnSwPjf706+snJYWNnWCLcNtTGWPvA1fvRwEUAfLxR1Zdg5LDfqw1YvSl0lMK5e3g5m3h+Bnz+PCce8dsfSU64M/K/nmBOoc+xeYeCvHbgbL2z7SqZQ2DmMOY7NuYyXvuOQscMdRDnZCXTCGYf1vdD6almSvYY8rChS+g40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786044241; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=rIxsQTrJGRlSuvbcERHIP5fAC7xK052RKLG0Z9nVQa0=; b=L24zViv5qiLzgGFXNGsn5g0uER9rWxSLo/JvblUAQ9okxX0YxX4PuWLVO5Y9Sjx5j85bLUmy9GH83X5NkTaKkIaarFpAsizKZik2CDesmWjYmwfwujIoi0DGDxj7JtF9DYdZYLtm+/RChbf1e0yChsRvGxP0E9alIs6LA54xJd4= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786044241; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=rIxsQTrJGRlSuvbcERHIP5fAC7xK052RKLG0Z9nVQa0=; b=ocA97hgnw3+wfEr/B2gx4RIf3GE8UPvHIOnkgCoey6GW7rg07+3yed3uwRPAxSly TeIyzzkxX2bZ+0AfaJSxsGJAONJaQuCa96PaVivWDkFl96nosVZW2d84+c5659G3/Jx 3IKi1minUkuD1zbMaSpMa7JyaXUiGVVP3SZXou1k= Received: by mx.zoho.eu with SMTPS id 1786044240160677.4841809777805; Thu, 6 Aug 2026 21:24:00 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] scsi: elx: efct: free the HIO when the WQE cannot be built Date: Thu, 6 Aug 2026 19:23:42 +0000 Message-ID: <20260806192345.328621-3-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" efct_els_hw_srrs_send() and efct_hw_bls_send() allocate an HIO, ask sli4 to build a WQE into it, and give up when that fails without putting the HIO back: if (sli_els_request64_wqe(&hw->sli, hio->wqe.wqebuf, hio->sgl, &els_params)) { efc_log_err(hw->os, "REQ WQE error\n"); rc =3D -EIO; } Nothing has been submitted at that point, so no completion will arrive to release it, and the entry sits on hw->io_inuse until the adapter is torn down. Each failure costs the pool one entry, and once it is empty efct_hw_io_alloc() fails and no further ELS, CT or BLS frame can be sent. Release the HIO on those paths. The efct_hw_wq_write() failure below is deliberately left alone: it can return an error while this request is still queued on wq->pending_list, so the HIO cannot be handed back there without more care. Fixes: dd53d333aadb ("scsi: elx: efct: Hardware I/O submission routines") Signed-off-by: Ali Ahmet Memis --- drivers/scsi/elx/efct/efct_hw.c | 38 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_h= w.c index 15c37ff1d52e..6cc48fa3e656 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -2609,6 +2609,7 @@ efct_hw_bls_send(struct efct *efct, u32 type, struct = sli_bls_params *bls_params, 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"); + efct_hw_io_free(hw, hio); return -EIO; } =20 @@ -2820,24 +2821,27 @@ efct_els_hw_srrs_send(struct efc *efc, struct efc_d= isc_io *io) rc =3D -EIO; } =20 - if (rc =3D=3D 0) { - hio->xbusy =3D true; + if (rc) { + efct_hw_io_free(hw, hio); + return rc; + } =20 - /* - * Add IO to active io wqe list before submitting, in case the - * wcqe processing preempts this thread. - */ - hio->wq->use_count++; - rc =3D efct_hw_wq_write(hio->wq, &hio->wqe); - if (rc >=3D 0) { - /* non-negative return is success */ - rc =3D 0; - } else { - /* failed to write wqe, remove from active wqe list */ - efc_log_err(hw->os, - "sli_queue_write failed: %d\n", rc); - hio->xbusy =3D false; - } + hio->xbusy =3D true; + + /* + * Add IO to active io wqe list before submitting, in case the + * wcqe processing preempts this thread. + */ + hio->wq->use_count++; + rc =3D efct_hw_wq_write(hio->wq, &hio->wqe); + if (rc >=3D 0) { + /* non-negative return is success */ + rc =3D 0; + } else { + /* failed to write wqe, remove from active wqe list */ + efc_log_err(hw->os, + "sli_queue_write failed: %d\n", rc); + hio->xbusy =3D false; } =20 return rc; --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F67338D3F2; Thu, 6 Aug 2026 20:23:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047833; cv=pass; b=Qhom5iBV1il71WnDxZ4+NmvapGY3pq7bdeA/w6G91ZLY5TN9DpHTltg0xmlw5o0l/t3oYq7V6clyuGCaWSW92ofDwRaT/MB1A0NRMXF1ZF5nHh8UFdObsKuX064vbNoTPFXFT7do2k3mOxskYy0Y/FMs4wAJsU8xI0hyZ01niEQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047833; c=relaxed/simple; bh=wnKu+FgPijdgZ7wQCNpgJJnUvujcvv4NLraMqraCZiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SDqNNTir1IlBC/Ywr6dxb2APTLdi9hXUXwpIxbJDcJ8XJ8be+7yEe0Ga0itrHbaCCqqJJ+lbyBJ3JOdRb6dVluy4UwMeLmCqZND2w+fgA8xJ2ZDCESY/EJtC7OPyxQX9gskVE96K3qFk1c11mTQx5GJCKqCwV7OOnxTBW5HO0t0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=CrgAgF6F; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="CrgAgF6F" ARC-Seal: i=1; a=rsa-sha256; t=1786047818; cv=none; d=zohomail.eu; s=zohoarc; b=JptTWq7RgETPc8dpG9kGmYzrUTEH+9boJUoQKHiMAb7m82YjZGb0vLCLEhAFyUy0uosP+tKuZYw1Tv/kKr8cHTBLzX6u8qTMpbIBfI/LhKhe+6FgjrYpUfO+jIlHW2+ng9LdyTL/4Y36imjptfWwC8j9y+AOgdWq+7wiDwG8saw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786047818; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=rIxsQTrJGRlSuvbcERHIP5fAC7xK052RKLG0Z9nVQa0=; b=hAWKSc7MJqWSwTvvXa0gEPoM4WSEvz1+qC9FXVfT73I2Y+lyCA6wqJQGmoM4KXsKQCcwvLhh+JzjudwBS/PRubn73HvacK5oX0QHUxhC8diccd5MepgcmNSX4unDQCHlfa1lvhSbvdYZIQWtk/WxDlF8R1OGGg/ISbDOJgBiGgY= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786047818; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=rIxsQTrJGRlSuvbcERHIP5fAC7xK052RKLG0Z9nVQa0=; b=CrgAgF6FqOVG+cb/rUCvk/iu7kjwZvGSO8aXCHsY8+DHPqvOv7hx+2nnsJbdpyAq u1vJNhDMPzpSjGhWzh9Nn4HnCbrNCk5AL7u1AxR+mO8vD/iSEtmUlalpg9ki/0v45R5 X0ifeh0GQTJ1xFzCH+zyP9OPg/vVNMuwdSK43vS4= Received: by mx.zoho.eu with SMTPS id 1786047816776585.1538283020542; Thu, 6 Aug 2026 22:23:36 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] scsi: elx: efct: free the HIO when the WQE cannot be built Date: Thu, 6 Aug 2026 20:22:02 +0000 Message-ID: <20260806202205.345326-3-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" efct_els_hw_srrs_send() and efct_hw_bls_send() allocate an HIO, ask sli4 to build a WQE into it, and give up when that fails without putting the HIO back: if (sli_els_request64_wqe(&hw->sli, hio->wqe.wqebuf, hio->sgl, &els_params)) { efc_log_err(hw->os, "REQ WQE error\n"); rc =3D -EIO; } Nothing has been submitted at that point, so no completion will arrive to release it, and the entry sits on hw->io_inuse until the adapter is torn down. Each failure costs the pool one entry, and once it is empty efct_hw_io_alloc() fails and no further ELS, CT or BLS frame can be sent. Release the HIO on those paths. The efct_hw_wq_write() failure below is deliberately left alone: it can return an error while this request is still queued on wq->pending_list, so the HIO cannot be handed back there without more care. Fixes: dd53d333aadb ("scsi: elx: efct: Hardware I/O submission routines") Signed-off-by: Ali Ahmet Memis --- drivers/scsi/elx/efct/efct_hw.c | 38 ++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_h= w.c index 15c37ff1d52e..6cc48fa3e656 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -2609,6 +2609,7 @@ efct_hw_bls_send(struct efct *efct, u32 type, struct = sli_bls_params *bls_params, 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"); + efct_hw_io_free(hw, hio); return -EIO; } =20 @@ -2820,24 +2821,27 @@ efct_els_hw_srrs_send(struct efc *efc, struct efc_d= isc_io *io) rc =3D -EIO; } =20 - if (rc =3D=3D 0) { - hio->xbusy =3D true; + if (rc) { + efct_hw_io_free(hw, hio); + return rc; + } =20 - /* - * Add IO to active io wqe list before submitting, in case the - * wcqe processing preempts this thread. - */ - hio->wq->use_count++; - rc =3D efct_hw_wq_write(hio->wq, &hio->wqe); - if (rc >=3D 0) { - /* non-negative return is success */ - rc =3D 0; - } else { - /* failed to write wqe, remove from active wqe list */ - efc_log_err(hw->os, - "sli_queue_write failed: %d\n", rc); - hio->xbusy =3D false; - } + hio->xbusy =3D true; + + /* + * Add IO to active io wqe list before submitting, in case the + * wcqe processing preempts this thread. + */ + hio->wq->use_count++; + rc =3D efct_hw_wq_write(hio->wq, &hio->wqe); + if (rc >=3D 0) { + /* non-negative return is success */ + rc =3D 0; + } else { + /* failed to write wqe, remove from active wqe list */ + efc_log_err(hw->os, + "sli_queue_write failed: %d\n", rc); + hio->xbusy =3D false; } =20 return rc; --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E99B4CA290; Thu, 6 Aug 2026 19:24:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044268; cv=pass; b=HJYKJhXxuojcEEAxmrwrgXwKiQKN2Er4RNCwoONfa8x+bty5SjjiZGEuKUSIINBjemTGKft5rNipSejbrNGEaftIf2fozPa9jq/skpIkx28+stOLGD/GEMBsenOldkh59iTk0pYXO7s6k0uFqQKwIirrsrlSMD2Gb2rfLxTQrEg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044268; c=relaxed/simple; bh=mPiOuN91rK3XCdzE7LwpgNEWAFRw/M29CjFNw+wLpWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xztk1oyBjgbynLW3jzWd8LWcOQSyIeRi8+3he2klXe1WKOKeafN0RJ1I0llZYLRb6dVAVNQoBhTJeaHmfWVPWHyplKbM+nw+Nt4GhhXs5ZI9YFiNA8HLIpp5Z9JAJ+SXMp4FX8S4Pv5ZS92wa7B9xNyDXYGoV1l2aMLtb0FFGnI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=bEqtlp2H; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="bEqtlp2H" ARC-Seal: i=1; a=rsa-sha256; t=1786044243; cv=none; d=zohomail.eu; s=zohoarc; b=c1AyH0bS5YF6uyE/MvEom7a0boqG64v8ZuxlezNtOf7cjBmdUR63jOWG2ONbZ4SIQBMj8x/MjinSlnb1epgwRo9gycwaOIUrDwEBFBY3gvJzFRD7MSTX0MJaAPb/KNY1C+7I6Q4ZXjSqXHCf+fzEfLo/HryXuKm+aFcHX2fSNHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786044243; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=qwA2JEJ7YTCewECkp2iVhinHMow8YkUY4BQcVqUpXXI=; b=V4mIFkijctqNEa5C6gRoVwsFIJppkdRAyFkOfgJ/4YiDcCrdx0L5glF8dFIaI0uXeI7aFRRAGZ+I4S2N4LDMKrTuhSbi+jh034rHSCAk+P34nVjCR8q1Vcwtw/FAgZFOG7I1dhdPKUb4IZjT8SKnC0DhFNnFx8VYcmD50KfeMeo= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786044243; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=qwA2JEJ7YTCewECkp2iVhinHMow8YkUY4BQcVqUpXXI=; b=bEqtlp2H9NVbnRyrr1QADvESOi1u8MHKZL/X1wcNc93mW+NQ1th7peH3nXitxBDX +/pT7rEx2xh7iauUsV9d/2HNiVioEQVBpC3Ot8ljIWhtfAyTVBI2aBlUVaXisYq2g1m TntPqNoOV30ZwHzks16HEj0omGuVoX0NX7JLJWzw= Received: by mx.zoho.eu with SMTPS id 1786044241008227.7698100355734; Thu, 6 Aug 2026 21:24:01 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] scsi: elx: efct: free the request tag when the send frame WQE fails Date: Thu, 6 Aug 2026 19:23:43 +0000 Message-ID: <20260806192345.328621-4-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" efct_hw_send_frame() takes a request tag from the pool and then builds the WQE. When sli_send_frame_wqe() fails it returns without giving the tag back: ctx->wqcb =3D efct_hw_reqtag_alloc(hw, callback, arg); if (!ctx->wqcb) { efc_log_err(hw->os, "can't allocate request tag\n"); return -ENOSPC; } ... if (rc) { efc_log_err(hw->os, "sli_send_frame_wqe failed: %d\n", rc); return -EIO; } Nothing is submitted, so the completion that would call efct_hw_reqtag_free() never runs and the tag stays out of the pool. The pool is bounded by the number of request tags allocated at init, so repeated failures leave send frame without any. Free the tag on that path. The efct_hw_wq_write() failure below is left alone: it can return an error while this request is still queued on wq->pending_list, and the tag is what a later completion would look the context up by. Fixes: dd53d333aadb ("scsi: elx: efct: Hardware I/O submission routines") Signed-off-by: Ali Ahmet Memis --- 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_h= w.c index 6cc48fa3e656..db68516e8075 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -3009,6 +3009,7 @@ efct_hw_send_frame(struct efct_hw *hw, struct fc_fram= e_header *hdr, ctx->wqcb->instance_index); if (rc) { efc_log_err(hw->os, "sli_send_frame_wqe failed: %d\n", rc); + efct_hw_reqtag_free(hw, ctx->wqcb); return -EIO; } =20 --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95C753D4123; Thu, 6 Aug 2026 20:23:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047833; cv=pass; b=ccPUGVWFz0Ro1yQlS4gQy7RLaXsQapKvhrX3KG6qemtajPS0tC1Nu/PXn7/6l4qHHQA3qKgFqnLE/o257WHNQT5B0RMA/ED8DR3VYNz46iEn6vKVJz0szDU5uWQAOZshr2ncFDjpIEZHB3HudkphKmveDXSeG+KLG79xvzj0VH0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047833; c=relaxed/simple; bh=mPiOuN91rK3XCdzE7LwpgNEWAFRw/M29CjFNw+wLpWE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gumOoWuotf5FdnBeC5LgoCX84mvBmRkHyz1p+6WcYxt2OzzgTb7lqoRZoHxko3D9ROtOpBjFTr4ftMJlgCMOLw+DpY2Ok/dqQBdYEgl2o6imah7Z9DiUEKoGbXu3F7XzjS0wiJ+idx1/fAq2ceQfP/1dqWaH+JmP9/z0jdzfmyg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=fWCvoUSc; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="fWCvoUSc" ARC-Seal: i=1; a=rsa-sha256; t=1786047822; cv=none; d=zohomail.eu; s=zohoarc; b=TFUBkzT7jAKXuaNz1V7BLvuHKNu2izjbmiBzTbO9kthCNRpbZYBao6kvgLSkgK65Lfvm6qSyZ84wMbhGRSCg5XXl6t/YDK3lqG4DDzClRAXIWtbYfLMsi5yZZT/UI1bJ8Rg372yRPXFlN86OtnV5JWhV4cKPlVjoOpcaXqMD7Vk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786047822; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=qwA2JEJ7YTCewECkp2iVhinHMow8YkUY4BQcVqUpXXI=; b=aWUAxUlM2oerazmol99zrtZv2TrgYgxQtATHGMSqzgKuBh/yVRXVPHbqKlSqNwmy3qOnh58EYCF1KnDSW6s6cXNAxyrXgj04dzAnUOTeBDBj/s1Tzaw4J+2gVNUE+XAfHMAVgAUlcCkLeg1Dj4V7tv0sqzRO9bGiaKGmgZ+szuo= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786047821; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=qwA2JEJ7YTCewECkp2iVhinHMow8YkUY4BQcVqUpXXI=; b=fWCvoUScNfe9RGJkWb3eAayuL2OXvKKlMFlAFNo7Poxia4/ygjp0k346CBjdl+Md GdcxfMJh8guN7dAILMl25acQgiH1IxgyqjsZC8XTbaic8xh8yDvsHztiGWvhaEwsnoy hchGiGyj/RgPcoEkpQiuI/RzB8OSIIMk44yfzi7g= Received: by mx.zoho.eu with SMTPS id 1786047818479756.1027164714634; Thu, 6 Aug 2026 22:23:38 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] scsi: elx: efct: free the request tag when the send frame WQE fails Date: Thu, 6 Aug 2026 20:22:03 +0000 Message-ID: <20260806202205.345326-4-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" efct_hw_send_frame() takes a request tag from the pool and then builds the WQE. When sli_send_frame_wqe() fails it returns without giving the tag back: ctx->wqcb =3D efct_hw_reqtag_alloc(hw, callback, arg); if (!ctx->wqcb) { efc_log_err(hw->os, "can't allocate request tag\n"); return -ENOSPC; } ... if (rc) { efc_log_err(hw->os, "sli_send_frame_wqe failed: %d\n", rc); return -EIO; } Nothing is submitted, so the completion that would call efct_hw_reqtag_free() never runs and the tag stays out of the pool. The pool is bounded by the number of request tags allocated at init, so repeated failures leave send frame without any. Free the tag on that path. The efct_hw_wq_write() failure below is left alone: it can return an error while this request is still queued on wq->pending_list, and the tag is what a later completion would look the context up by. Fixes: dd53d333aadb ("scsi: elx: efct: Hardware I/O submission routines") Signed-off-by: Ali Ahmet Memis --- 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_h= w.c index 6cc48fa3e656..db68516e8075 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -3009,6 +3009,7 @@ efct_hw_send_frame(struct efct_hw *hw, struct fc_fram= e_header *hdr, ctx->wqcb->instance_index); if (rc) { efc_log_err(hw->os, "sli_send_frame_wqe failed: %d\n", rc); + efct_hw_reqtag_free(hw, ctx->wqcb); return -EIO; } =20 --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D7314D2EF8; Thu, 6 Aug 2026 19:24:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044263; cv=pass; b=SM8t9QSh0KgRe9eZXrqShRTbecyL6vZ+Ad9ILMrZvF3dYRiQyWQhgP4Z1FGKKaD3W/G8aDiCXwXH4Ng7Q9ny1sldqNvda5KFr9bGpXAOybOQrLZSochybH9Wyq1V14GZeL+r2SE0JfUyQGJkTOpYWWVs74Ui/Zvm3faaN03eZjg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044263; c=relaxed/simple; bh=mbBlgjmVN5cUBifkjEgEyu0GUSFJxXbX0rZg7Nb6EF8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ni7TJl1DvwchaKJ7+4KHrQjWdSl+LssG91Y8gHfgR7c+JPRlubM9DfSGF6VP5eG2wIgCwRc8uD/hXx8aAEDF1MogNx5SuH3Z/jAAenNUohYn6BKKeoKSi+3vyanTYh3PVXwPYbFoXbzFZqNXCjEzVNx0Su67zqYJSId3iuT1jVA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=nOoh/FRH; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="nOoh/FRH" ARC-Seal: i=1; a=rsa-sha256; t=1786044242; cv=none; d=zohomail.eu; s=zohoarc; b=g7TSQt/d99RtYSBTTEo0AIRSCPHE2NwpsixRhxDTkVTc4BuCw4YZxf3tAJVJAHObRXsb+O3kWa4npUTLki54h/5NoDK3sKtk3ZMohgtgMxpJUsutQrDEMIfNK1+j+c9soSmtvMbmj5lqVZeQYDTdXn8QDSef++K37gMVX4vg2SA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786044242; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=4sPAix17R1RQ+ZPo4cVzETgK7IB/8stOZkQGjf8f7t8=; b=TQuOiUCGsxTv+5r2WPRM0DTwXUURnoII8GCxV16eNsTqHslPiEkWTxKQnVOVHeZWwiywRgPnyri2wYTW7yJtoWVmA8Clp+l+SFx0ddELLe5IdKC8wXbiO/U4z1wRYvP/EbsQkp0/0h88OyfwhagnlkR5jpRexdY0/3P4PICMboQ= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786044242; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=4sPAix17R1RQ+ZPo4cVzETgK7IB/8stOZkQGjf8f7t8=; b=nOoh/FRH40yygO+/GkBJ3+kt04S/GUXQsfJXOpAdg+k/cS71F3EmL4NbPgkllavJ i1MWHxZN+CiNpwaN1p7A+bedT3j9bYjsiH80RaqrNjYNwCY8DcXeMXIZE60H4KChlyQ fVKWTcN3Emj6j4aTtcTPkks920vC0QNdt/tIBBHM= Received: by mx.zoho.eu with SMTPS id 1786044241824628.2237964188298; Thu, 6 Aug 2026 21:24:01 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] scsi: elx: efct: free the RQ buffers already allocated when one fails Date: Thu, 6 Aug 2026 19:23:44 +0000 Message-ID: <20260806192345.328621-5-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" efct_hw_rx_buffer_alloc() allocates an array of descriptors and then a coherent DMA buffer for each entry. When one of those allocations fails it frees the array and returns NULL, leaving every buffer allocated before it mapped: if (!prq->dma.virt) { efc_log_err(hw->os, "DMA allocation failed\n"); kfree(rq_buf); return NULL; } The caller only sees NULL and the array that held the addresses is gone, so nothing can free them afterwards. efct_hw_rx_free() cannot help either, it walks rq->hdr_buf and rq->payload_buf, which are only assigned once this function succeeds. Use efct_hw_rx_buffer_free() for the entries that were filled in. Fixes: 580c0255e4ef ("scsi: elx: efct: RQ buffer, memory pool allocation an= d deallocation APIs") Signed-off-by: Ali Ahmet Memis --- drivers/scsi/elx/efct/efct_hw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_h= w.c index db68516e8075..d645ce256b8a 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -1170,6 +1170,10 @@ efct_get_wwpn(struct efct_hw *hw) return get_unaligned_be64(p); } =20 +static void +efct_hw_rx_buffer_free(struct efct_hw *hw, struct efc_hw_rq_buffer *rq_buf, + u32 count); + static struct efc_hw_rq_buffer * efct_hw_rx_buffer_alloc(struct efct_hw *hw, u32 rqindex, u32 count, u32 size) @@ -1196,7 +1200,7 @@ efct_hw_rx_buffer_alloc(struct efct_hw *hw, u32 rqind= ex, u32 count, GFP_KERNEL); if (!prq->dma.virt) { efc_log_err(hw->os, "DMA allocation failed\n"); - kfree(rq_buf); + efct_hw_rx_buffer_free(hw, rq_buf, i); return NULL; } } --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 314273EC6B5; Thu, 6 Aug 2026 20:23:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047835; cv=pass; b=bD4w5egK93YAwiy2Pwahpv0SKUOUAfRfs/wONa5BUyKlWq+sQWhFrmBrM4VgaPiBGRSPJKqWTDjeIBdSdqbKh91qI7s67JJGuCQIByBJPr51ieWEZ6ZoH9hctP2sr1aOMcVMAcsu6Ho0pBd5ruPojv+CFUJszvyTYkhWCfp3Oc0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047835; c=relaxed/simple; bh=mbBlgjmVN5cUBifkjEgEyu0GUSFJxXbX0rZg7Nb6EF8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=vAZxMikj2WK/LSZ8RWkYBzIbEb4FHp1Jsw8rJxUPMd+ARQ9Q7OCj4s33Ag+9QHcwap5+yI5tFqZklsHWu9RlMOQ2S4UEzJHjpC1JfAeAM/C7UnTpQzAbulUtZBUZ8sTaqqDFaUZa7GxnHIT0OP5BkqxhXw7lF3X3qu3DprRCQlQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=NXNeZJTJ; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="NXNeZJTJ" ARC-Seal: i=1; a=rsa-sha256; t=1786047822; cv=none; d=zohomail.eu; s=zohoarc; b=BmyrcAGGlYYHM7NXeI7bwxRCVZS2NDr5miLmbS3ZtkRnBfsWCm0ECCXQs1wWkMg0c5Zb7jwpEAUS85+qFAzEMZV8d5brb4ruRLwcfxUREAw8FZhO1UsuknS4yjBufjrsT//lMFw2fxw37BN+cZEbthDlUacbCoZnGPmtU9KfW7k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786047822; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=4sPAix17R1RQ+ZPo4cVzETgK7IB/8stOZkQGjf8f7t8=; b=AckbvBNtnpMEevSrbA30n4sGQYxZvhR60Ncpb55U0r+xa9BeWQTWdwVezioMfOuzi7+2SDv0z12O/vImlYPGkZktGqqoAJbMmw7LM8XH2USVzeTfDI+a5cyLFrvgitb9n9TwF8d2EtFueXJmxXDUDDAD3BhCuV3FWXIhD/NjxEQ= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786047822; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=4sPAix17R1RQ+ZPo4cVzETgK7IB/8stOZkQGjf8f7t8=; b=NXNeZJTJx3e4+IHimTz4WSCHNTyty8wUeUlo8OQqqWheVKh3Wj09cHEIcZhFNZs2 9qP4pF086ebf/n+Cc7YzEQiR4TWtfCwr3xl9FBdttSATITWkCcSnOAJDKIAIJNhVoKI KxLbIa0QvaG2JgliTZiOidGnw3ZqAuZ93Loe4x8w= Received: by mx.zoho.eu with SMTPS id 1786047819355837.1434305723302; Thu, 6 Aug 2026 22:23:39 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] scsi: elx: efct: free the RQ buffers already allocated when one fails Date: Thu, 6 Aug 2026 20:22:04 +0000 Message-ID: <20260806202205.345326-5-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" efct_hw_rx_buffer_alloc() allocates an array of descriptors and then a coherent DMA buffer for each entry. When one of those allocations fails it frees the array and returns NULL, leaving every buffer allocated before it mapped: if (!prq->dma.virt) { efc_log_err(hw->os, "DMA allocation failed\n"); kfree(rq_buf); return NULL; } The caller only sees NULL and the array that held the addresses is gone, so nothing can free them afterwards. efct_hw_rx_free() cannot help either, it walks rq->hdr_buf and rq->payload_buf, which are only assigned once this function succeeds. Use efct_hw_rx_buffer_free() for the entries that were filled in. Fixes: 580c0255e4ef ("scsi: elx: efct: RQ buffer, memory pool allocation an= d deallocation APIs") Signed-off-by: Ali Ahmet Memis --- drivers/scsi/elx/efct/efct_hw.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_h= w.c index db68516e8075..d645ce256b8a 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -1170,6 +1170,10 @@ efct_get_wwpn(struct efct_hw *hw) return get_unaligned_be64(p); } =20 +static void +efct_hw_rx_buffer_free(struct efct_hw *hw, struct efc_hw_rq_buffer *rq_buf, + u32 count); + static struct efc_hw_rq_buffer * efct_hw_rx_buffer_alloc(struct efct_hw *hw, u32 rqindex, u32 count, u32 size) @@ -1196,7 +1200,7 @@ efct_hw_rx_buffer_alloc(struct efct_hw *hw, u32 rqind= ex, u32 count, GFP_KERNEL); if (!prq->dma.virt) { efc_log_err(hw->os, "DMA allocation failed\n"); - kfree(rq_buf); + efct_hw_rx_buffer_free(hw, rq_buf, i); return NULL; } } --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 95D7F3E7BCB; Thu, 6 Aug 2026 20:23:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047834; cv=pass; b=ie4dTWs1R66v6OsNtsaaOfaHOY3xcCnhjIA5xIRMzW6XbYNyQqt5DDl/NJ51OWjfbxhIYdxfxkPIMgaAR6OtBUPzl+Ot/g3HGEG+RsNNX2Vy9hAy5F0bWDZuH802lAuXuxwiZNMpm/lwlCwhWSIqZlOUUOyFPqQG0EF1l+ffnQQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786047834; c=relaxed/simple; bh=O5ITA1hRKQxLbOP1dSGdrqvvn+2TkNe8GmZYwsFoQTY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=h0nyfYFQglbBWGZ/pT4Y5DOV7k9sRP0lhvlI1xDEZ6RFIYKKiv4jUNBumtcjuQcHc/dehuS7GRX6ySC/3+ghDWTtE3XIuF0wpx/UQyPBLCMT+KL1ncF6EbYU/0R0PfAmf0Bi8fCICgkCofkYWqFqx2MzJHRU9XU0gwWVNpFYhC4= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=pCtkYzjO; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="pCtkYzjO" ARC-Seal: i=1; a=rsa-sha256; t=1786047821; cv=none; d=zohomail.eu; s=zohoarc; b=IMIFmC0xxtdbmh4C6IMJJGp2DyVoTFxI2KXZh3xnuYRGJ0FHLvW281cjxUMRhu8Mnmw8Z9mIzV9rRR2GbVROqT4eM3zA6tWvrX5c/OfmMLPMGcy8JAsooJJHMHkGQP0NIv05aD0s/BTo5cmfjoJws9Vri3cFfjH62paJIjAIn4E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786047821; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=xRmuc/gsRP4f7T15VlO6DqUDaUKqM6RdEbym3UlziwM=; b=MmiCY1MB4JvvPcASTYkh2xq3svH7IAyoFjoe+s6+5Mu8UKOvEgLdlhVmkjuo0ixhDAnPgrIbLMD8b4h1+lDr20R7AgA1MvimhvZDJqbsYL8wotmDAN9S2hkcgeEgW/xpZZrYUdmD6OKdkcdmCmRyf04xOGOON9D4CA+sffhQXQo= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786047821; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=xRmuc/gsRP4f7T15VlO6DqUDaUKqM6RdEbym3UlziwM=; b=pCtkYzjO+tK6hFuBQX8PJglOSM1LVvXsq3PXDnXiu/nPw+Ft44cxKDhpI6E45FcL oxzBfDPzbNYx+EIkYW0wY9XyoV6lVdhaBpJsUIDVV6ya/+nLYbkODJV1xbv0W9xfQVP nzTab1/ObnCJynpo6HVI8bKW5cfw58YC27Cibibk= Received: by mx.zoho.eu with SMTPS id 1786047820243429.61267377833224; Thu, 6 Aug 2026 22:23:40 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] scsi: elx: efct: destroy the mailbox pools when setup fails Date: Thu, 6 Aug 2026 20:22:05 +0000 Message-ID: <20260806202205.345326-6-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" efct_hw_setup() creates two mempools and then calls sli_setup(). Both of its error paths return without destroying what it already created: hw->cmd_ctx_pool =3D mempool_create_kmalloc_pool(...); if (!hw->cmd_ctx_pool) return -EIO; hw->mbox_rqst_pool =3D mempool_create_kmalloc_pool(...); if (!hw->mbox_rqst_pool) return -EIO; ... if (sli_setup(&hw->sli, hw->os, pdev, ((struct efct *)os)->reg)) return -EIO; mempool_destroy() for these two runs only in efct_hw_teardown(), which is not reached here. efct_hw_setup() is called from efct_device_interrupts_required(), and when it fails efct_pci_probe() unwinds through efct_device_free(), freeing the struct efct that held the only pointers to the pools. Destroy them on the way out, and clear hw_setup_called so that a later call does not take the early return and hand the caller a half configured hw. Reproduced by binding the driver to a PCI device that is not an SLI-4 adapter, so sli_setup() fails, and repeating the probe 61 times. Before, with CONFIG_DEBUG_KMEMLEAK: unreferenced object 0xffff888008449680 (size 96): comm "init", pid 1 backtrace: __kmalloc_cache_node_noprof+0x3b9/0x430 mempool_create_node_noprof+0x78/0xe0 efct_hw_setup+0x1db/0xb50 efct_pci_probe+0x3cb/0x6dd local_pci_probe+0xd4/0x170 1566 objects in total, every one of them from efct_hw_setup(). After the change the same run reports none, and the probe still fails the same way. Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines") Signed-off-by: Ali Ahmet Memis --- drivers/scsi/elx/efct/efct_hw.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_h= w.c index d645ce256b8a..f764fde665b0 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -256,7 +256,7 @@ efct_hw_setup(struct efct_hw *hw, void *os, struct pci_= dev *pdev) sizeof(struct efct_command_ctx)); if (!hw->cmd_ctx_pool) { efc_log_err(hw->os, "failed to allocate mailbox buffer pool\n"); - return -EIO; + goto not_setup; } =20 /* Create mailbox request ctx pool for library callback */ @@ -264,7 +264,7 @@ efct_hw_setup(struct efct_hw *hw, void *os, struct pci_= dev *pdev) sizeof(struct efct_mbox_rqst_ctx)); if (!hw->mbox_rqst_pool) { efc_log_err(hw->os, "failed to allocate mbox request pool\n"); - return -EIO; + goto free_cmd_ctx_pool; } =20 spin_lock_init(&hw->io_lock); @@ -277,7 +277,7 @@ efct_hw_setup(struct efct_hw *hw, void *os, struct pci_= dev *pdev) hw->config.speed =3D SLI4_LINK_SPEED_AUTO_16_8_4; if (sli_setup(&hw->sli, hw->os, pdev, ((struct efct *)os)->reg)) { efc_log_err(hw->os, "SLI setup failed\n"); - return -EIO; + goto free_mbox_rqst_pool; } =20 efct_hw_link_event_init(hw); @@ -313,6 +313,17 @@ efct_hw_setup(struct efct_hw *hw, void *os, struct pci= _dev *pdev) (void)efct_hw_read_max_dump_size(hw); =20 return 0; + +free_mbox_rqst_pool: + mempool_destroy(hw->mbox_rqst_pool); + hw->mbox_rqst_pool =3D NULL; +free_cmd_ctx_pool: + mempool_destroy(hw->cmd_ctx_pool); + hw->cmd_ctx_pool =3D NULL; +not_setup: + hw->hw_setup_called =3D false; + + return -EIO; } =20 static void --=20 2.55.0 From nobody Tue Sep 29 14:54:44 2026 Received: from sender-of-o57.zoho.eu (sender-of-o57.zoho.eu [136.143.169.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 67A2E4D2ECC; Thu, 6 Aug 2026 19:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.169.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044267; cv=pass; b=s2W6f1EsSpYF2AEIf7hiQxX2oy5YnMYLUEtgTtWMcnRNIPe2KNQZKoFQHEkzijkWcl27LSw36z/Lun+zQu0uj4je4+A0+ybuzJG+x/PJV/iV8eCG5wYLM8Zht4aw+61KG9Pze8F+ojmzUSVeBrOTOS8per5p9/1zn93L1nV+Qhw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786044267; c=relaxed/simple; bh=lfnjD86EbQDLQcLvbO79G/C1EoI4gKr2Au25BGtobio=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fu17UGZqq8TikGuJYH3K/h7CULmBglAGbZ5/CSylEygTSZjb89LYDBPG6mlZot9NR+4UlCmV9eDSX3q4Vh+A4UAJ8WM97D0fq7UTCgvyrgMgdICjgNxFkeQq9m4UK3AdhASBeToJlBKHBqQGzT7biV91wi6XkNL7+MSm9LXiRbM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com; spf=pass smtp.mailfrom=iusegentoo.com; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b=nUMdlA9e; arc=pass smtp.client-ip=136.143.169.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iusegentoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=iusegentoo.com header.i=ali@iusegentoo.com header.b="nUMdlA9e" ARC-Seal: i=1; a=rsa-sha256; t=1786044245; cv=none; d=zohomail.eu; s=zohoarc; b=cgO3Y87ujQhsGiAIQwcv2sSNj6Ym20RL+XQetGCPqd5CiIwobL5ECVYbZEkvsDiFJatzQu1Y5SNUY/ERFIBTT2ZAMSUzfePxn8P/bq3ziu1p0qG/bbIEuBK5yI2fRamKQmmNIPKNAShe4zKd+0M1Ld0/xSRzJKGpFPjO+AznZFY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1786044245; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=8B3CIgkL3b4Ph6zdSr6uHE4ZnrtlHzQtDq/MLv5BOY0=; b=hv3DSYcBkvaAiXAHLq8mGk/ktuMlYx1ReAd+II6t/3dXSngmNyw/MVGYYB6DN1Wm6R1Fm5vxLc36K8kfgWLD++R1hiVittQaSnB485vJzfy543/7/STE7vATN9jM03vdSjIvXTRWg3EmUomUR+pZd9G1BezWV6IsRIq86NnER2I= ARC-Authentication-Results: i=1; mx.zohomail.eu; dkim=pass header.i=iusegentoo.com; spf=pass smtp.mailfrom=ali@iusegentoo.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1786044245; s=zmail; d=iusegentoo.com; i=ali@iusegentoo.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=8B3CIgkL3b4Ph6zdSr6uHE4ZnrtlHzQtDq/MLv5BOY0=; b=nUMdlA9enbfmygXi6bXld5LX/yrxIPhbx9Q+hCmt1kZqDX65BBBcu8gM1uDzty1n 2UQHhq1xpWIu1PWlNJL1OF8eKMzwr8hdwo/6PQQNh0yevXl9H/F9hOEG6j7Wl2Mk5JD o8U4b1ML4K6CK8Axob6VbetVNf/JlSF61GDrgjNc= Received: by mx.zoho.eu with SMTPS id 1786044242652183.80503244895579; Thu, 6 Aug 2026 21:24:02 +0200 (CEST) From: Ali Ahmet Memis To: "Martin K . Petersen" , Ram Vegesna , "James E.J. Bottomley" Cc: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] scsi: elx: efct: destroy the mailbox pools when setup fails Date: Thu, 6 Aug 2026 19:23:45 +0000 Message-ID: <20260806192345.328621-6-ali@iusegentoo.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260806192345.328621-1-ali@iusegentoo.com> References: <20260806192345.328621-1-ali@iusegentoo.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" efct_hw_setup() creates two mempools and then calls sli_setup(). Both of its error paths return without destroying what it already created: hw->cmd_ctx_pool =3D mempool_create_kmalloc_pool(...); if (!hw->cmd_ctx_pool) return -EIO; hw->mbox_rqst_pool =3D mempool_create_kmalloc_pool(...); if (!hw->mbox_rqst_pool) return -EIO; ... if (sli_setup(&hw->sli, hw->os, pdev, ((struct efct *)os)->reg)) return -EIO; mempool_destroy() for these two runs only in efct_hw_teardown(), which is not reached here. efct_hw_setup() is called from efct_device_interrupts_required(), and when it fails efct_pci_probe() unwinds through efct_device_free(), freeing the struct efct that held the only pointers to the pools. Destroy them on the way out, and clear hw_setup_called so that a later call does not take the early return and hand the caller a half configured hw. Reproduced by binding the driver to a PCI device that is not an SLI-4 adapter, so sli_setup() fails, and repeating the probe 61 times. Before, with CONFIG_DEBUG_KMEMLEAK: unreferenced object 0xffff888008449680 (size 96): comm "init", pid 1 backtrace: __kmalloc_cache_node_noprof+0x3b9/0x430 mempool_create_node_noprof+0x78/0xe0 efct_hw_setup+0x1db/0xb50 efct_pci_probe+0x3cb/0x6dd local_pci_probe+0xd4/0x170 1566 objects in total, every one of them from efct_hw_setup(). After the change the same run reports none, and the probe still fails the same way. Fixes: 4df84e846624 ("scsi: elx: efct: Driver initialization routines") Signed-off-by: Ali Ahmet Memis --- drivers/scsi/elx/efct/efct_hw.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/elx/efct/efct_hw.c b/drivers/scsi/elx/efct/efct_h= w.c index d645ce256b8a..efbf29d3386e 100644 --- a/drivers/scsi/elx/efct/efct_hw.c +++ b/drivers/scsi/elx/efct/efct_hw.c @@ -264,7 +264,7 @@ efct_hw_setup(struct efct_hw *hw, void *os, struct pci_= dev *pdev) sizeof(struct efct_mbox_rqst_ctx)); if (!hw->mbox_rqst_pool) { efc_log_err(hw->os, "failed to allocate mbox request pool\n"); - return -EIO; + goto free_cmd_ctx_pool; } =20 spin_lock_init(&hw->io_lock); @@ -277,7 +277,7 @@ efct_hw_setup(struct efct_hw *hw, void *os, struct pci_= dev *pdev) hw->config.speed =3D SLI4_LINK_SPEED_AUTO_16_8_4; if (sli_setup(&hw->sli, hw->os, pdev, ((struct efct *)os)->reg)) { efc_log_err(hw->os, "SLI setup failed\n"); - return -EIO; + goto free_mbox_rqst_pool; } =20 efct_hw_link_event_init(hw); @@ -313,6 +313,16 @@ efct_hw_setup(struct efct_hw *hw, void *os, struct pci= _dev *pdev) (void)efct_hw_read_max_dump_size(hw); =20 return 0; + +free_mbox_rqst_pool: + mempool_destroy(hw->mbox_rqst_pool); + hw->mbox_rqst_pool =3D NULL; +free_cmd_ctx_pool: + mempool_destroy(hw->cmd_ctx_pool); + hw->cmd_ctx_pool =3D NULL; + hw->hw_setup_called =3D false; + + return -EIO; } =20 static void --=20 2.55.0