From nobody Fri Apr 3 10:20:50 2026 Received: from cstnet.cn (smtp25.cstnet.cn [159.226.251.25]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA35C24634F; Tue, 24 Mar 2026 10:56:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.25 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774349818; cv=none; b=sogyI/IYZx1nh8xEiV91ulHK+z/D0N01qU4aC+HUdIgAXMu+NG3jn0c4etfgMxl2r3J/biDpTYDqi29gSrR9OXYiqbV61KoaATyg0ejZnSDCyUrvNoPFQM7Fwrz9I0VA9o54BT7XsP0UDuoKEPWx8T3x7qSyT+VjvglWGIgiuPU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774349818; c=relaxed/simple; bh=ocmcfLK2NLl1s6pf7dgWfIT7+5DP2mvCMguliftdYxs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OD665apD31rwbCnMuGnd9yKkhmoFOdSOC761xi6toosCALX/70IKRlwqYVLhEbE5hht7huKxOG25VqhbIgrvGTp/5T8wNC557qR3NZ4CdBsiYZ6NJ3e9DukWTVa2KD4VZXMnrgLA83jhjcjqCpweWMa4q2y079wUgdl219pGUuI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.25 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost.localdomain (unknown [111.196.245.197]) by APP-05 (Coremail) with SMTP id zQCowAAXpQjvbcJpsKxTCw--.52795S2; Tue, 24 Mar 2026 18:56:48 +0800 (CST) From: Pengpeng Hou To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, pengpeng@iscas.ac.cn Subject: [PATCH] qed: fcoe: limit command queue array fill to the ramrod array size Date: Tue, 24 Mar 2026 18:56:47 +0800 Message-ID: <20260324105647.92763-1-pengpeng@iscas.ac.cn> X-Mailer: git-send-email 2.50.1 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-CM-TRANSID: zQCowAAXpQjvbcJpsKxTCw--.52795S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KFyUXr1fZw4UXw4xCrW7Jwb_yoW8Ww1kpw 47Z3yq9a18XF43t397Zw40vrnxua42yryUKFy7t34a939xZr13XF98CFW5J34xtrs3XF18 tr1jvrnxCFnxJ37anT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkG14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r1I6r4UM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s 0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xII jxv20xvE14v26r106r15McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr 1lF7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkF7I0En4kS14v26r12 6r1DMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAFwI 0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc40Y 0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF0xvE2Ix0cI8IcVCY1x0267AKxV W8JVWxJwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Gr0_Cr1l IxAIcVC2z280aVCY1x0267AKxVW8Jr0_Cr1UYxBIdaVFxhVjvjDU0xZFpf9x0JUvXd8UUU UU= X-CM-SenderInfo: pshqw1xhqjqxpvfd2hldfou0/ Content-Type: text/plain; charset="utf-8" qed_sp_fcoe_func_start() validates fcoe_pf_params->num_cqs against the number of command queues exposed by the hardware resource table, but it then uses that count to fill q_params.cq_cmdq_sb_num_arr[] in the FCoE init ramrod. That array is fixed at SCSI_MAX_NUM_OF_CMDQS entries. The in-tree qedf caller derives num_cqs from the device's reported num_cqs and the online CPU count, so current-tree callers can request more queues than fit in the fixed ramrod array on sufficiently large systems even though the existing hardware-resource check passes. Reject queue counts that exceed the command queue array capacity before filling the ramrod. Signed-off-by: Pengpeng Hou --- drivers/net/ethernet/qlogic/qed/qed_fcoe.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qed/qed_fcoe.c b/drivers/net/ether= net/qlogic/qed/qed_fcoe.c index 2ae3639d6cf7..5fbf78f6adca 100644 --- a/drivers/net/ethernet/qlogic/qed/qed_fcoe.c +++ b/drivers/net/ethernet/qlogic/qed/qed_fcoe.c @@ -126,6 +126,15 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn, goto err; } =20 + if (fcoe_pf_params->num_cqs > ARRAY_SIZE(p_data->q_params.cq_cmdq_sb_num_= arr)) { + DP_ERR(p_hwfn, + "Cannot fit %u queues in %zu command queue slots. Aborting functi= on start\n", + fcoe_pf_params->num_cqs, + ARRAY_SIZE(p_data->q_params.cq_cmdq_sb_num_arr)); + rc =3D -EINVAL; + goto err; + } + p_data->mtu =3D cpu_to_le16(fcoe_pf_params->mtu); tmp =3D cpu_to_le16(fcoe_pf_params->sq_num_pbl_pages); p_data->sq_num_pages_in_pbl =3D tmp; --=20 2.50.1 (Apple Git-155)