🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16697

[PATCH net] net: qed: fix dead NULL check on the MPA buffer list

#16697
From: Ziheng Wei
Date: Sun, 15 Nov 2026 16:18
54 lines
10515 bytes
qed_iwarp_ll2_comp_mpa_pkt() takes a buffer from mpa_buf_list with
list_first_entry() and then checks the result for NULL. list_first_entry()
never returns NULL: on an empty list it returns a pointer computed from
the list head, so the "No free mpa buf" error path is dead and the list
head is used as a struct qed_iwarp_ll2_mpa_buf.

Buffers taken here go back to mpa_buf_list only through
qed_iwarp_process_pending_pkts(), which keeps a buffer on the pending
list while an FPDU is split across packets (-EBUSY). Whether the list
can run empty in practice depends on traffic and rx_num_desc; the driver
already has an error path for it, which just never runs.

Commit fbb8bc408027 ("net: qed: Remove redundant NULL checks after
list_first_entry()") removed the other checks of this kind in qed where
the list was known to be non-empty. Nothing guarantees that here, so
keep the check and make it effective with list_first_entry_or_null().

Found by LLM-assisted source review. Validated only with a test module
that calls the function with an empty mpa_buf_list, which oopses in
__list_add_valid_or_report(). The fix was build tested only; it was not
run against that module, selftests or hardware.

Fixes: fcb39f6c10b2 ("qed: Add mpa buffer descriptors for storing and processing mpa fpdus")
Cc: stable@vger.kernel.org
Signed-off-by: Ziheng Wei <zihengw03@163.com>
---

Notes:
    The changelog was drafted with an AI assistant from my analysis;
    I have reviewed the code, the fix and the text.

 drivers/net/ethernet/qlogic/qed/qed_iwarp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
index 4d1ce9b1a..057d6c0bd 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_iwarp.c
@@ -2314,8 +2314,8 @@ qed_iwarp_ll2_comp_mpa_pkt(void *cxt, struct qed_ll2_comp_rx_data *data)
 	u16 first_mpa_offset;
 
 	iwarp_info = &p_hwfn->p_rdma_info->iwarp;
-	mpa_buf = list_first_entry(&iwarp_info->mpa_buf_list,
-				   struct qed_iwarp_ll2_mpa_buf, list_entry);
+	mpa_buf = list_first_entry_or_null(&iwarp_info->mpa_buf_list,
+					   struct qed_iwarp_ll2_mpa_buf, list_entry);
 	if (!mpa_buf) {
 		DP_ERR(p_hwfn, "No free mpa buf\n");
 		goto err;

base-commit: 97d73c8251226cf27cc6656b4c542869bb8c69fa
-- 
2.43.0
Technical Details
Message-ID: <20261115161815.941090-1-zihengw03@163.com>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363761-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363761-linux-kernel-netdev=dewy.ru
From: zihengw03@163.com (Ziheng Wei)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] net: qed: fix dead NULL check on the MPA buffer list
Date: Mon, 16 Nov 2026 00:18:15 +0800
Organization: Usenet Network
Message-ID: <20261115161815.941090-1-zihengw03@163.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1848569"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:T+gSI+L6PvRS9P0YQT46+W6MQxU= sha256:E5YMRf/EomuCT+1zlpD0kHJ3tbO++JOQZzhMbA9EvkE=
	sha1:ErrJyc0S0yZBqG1KFOcN47c3EOo= sha256:XjHZH9tdNck687huxOiQ8pODQkW0UUHVNGgez7lgbnY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 69980114A0B; Sun, 15 Nov 2026 19:19:35 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.148
X-Spam-Status: No, score=-3.148 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	UNPARSEABLE_RELAY=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=163.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ZJxgwVshFu5j;
	Sun, 15 Nov 2026 19:19:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-363761-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=163.com
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 935F4114A09; Sun, 15 Nov 2026 19:19:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id A06FC6064AD; Sun, 15 Nov 2026 16:19:06 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794759544;
	b=Tph3CPqJPSwxjgYvD32zA8wJYoQL/opeUDpjnGYkPGIBmv/cV+46c7m6/K4umKKXkC1K
	 NEk/TXwTw+eoFCEYViQKBpfDbbvGOxc1SdsjZoAbkgglrNJb2y87lQgWhC0XfZ0dck+PW
	 IzwbbfmH6ijRVa8n3FgbZL6FnJrT1lsXDe2ebjTkK2tosWzXuxmPlvZk9CnPR+mLnIwZq
	 09eqdXN8nHF8NGclDWSuPSV3e3DmV7pNp0fY7KciXBr6SfG/SvI+yR6CujwISI0GAdOW8
	 bHmFK6q1Jn+/XT9OGdhdASt6Xc3de1pjU5tP8XE3oLzovPyyKWyrE9JjujUgzfKYN2w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794759544;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding:X-CM-TRANSID:
	 X-Coremail-Antispam:X-CM-SenderInfo;
	bh=rC46ljI1wkzuuDt36qNW3ZBG08s5+InoUkoZUDEJRkM=;
	b=OyBulu9f8qjMqvcBsrdRf4c13Wmrh7/2KiAKV6neAdnbgxYRrKRX189UJtclhfjcAfXJ
	 CRnjL5hjx+gX9ulSNa5Quwj3lXV0qq/WidreD0zY/YWMXBc7odqOTbaf/uv4wtuTh5Fpg
	 PuOtnX/HyG28vZ+/N7nGt5Yox/LbhYxe2mSeW5ZZ9N4WZI2zDnsTqDU7CIRaRlvp0Jzs9
	 1v91IzErJD5ITgXWJOobrsQ4RznE9ioPbD2Ujof6cQgtMKwTkwoFzZfkijtQofnOO/7f6
	 I1mhiHV1ea8aDHOIaIfq6X8RsxdCCa1PMELgHkJFOTcdfY3TGkh5dthCijCtK1x2QhA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Z2D8lpiQ;
	dmarc=pass header.from=163.com;
	spf=pass smtp.mailfrom=163.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 39B4B606A33E;
	Sun, 15 Nov 2026 16:19:04 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Z2D8lpiQ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.3
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794759538;
	b=3GrOGIpVtcSD5qLbLPrED9edbL5lPR+yr7DMa2koGKmUojKSgP3G45jg2i3oPdYsr6Wq
	 G3s8toti7Hy62dHHiUMm6D7mDNxZzAXPmu0NM6205lFyXwYhcPzbnpBrNt4dL/e8XYy32
	 T0RPsr1/ukroEddOhMtxQMLLN8wJQFDB0tqXzu81TinB8r7JuJVot8kls8uxHtRjYwG68
	 1ObelyiC9m+6lqM8GXe5YWYKeom8hLj1cvUw4WzNuc5IOKXsHYLT3TLZuuV7Oh8YajfLL
	 FTVFh5u3gIW7pJaqSr6CdidPCux+vy3PMGx5wi1fGNZfsCQ2hDYCqPeMohJiU4cuOCQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794759538;
	h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding:
	 X-CM-TRANSID:X-Coremail-Antispam:X-CM-SenderInfo;
	bh=rC46ljI1wkzuuDt36qNW3ZBG08s5+InoUkoZUDEJRkM=;
	b=vnuw5WlnwA019k2RFjoBcgVNZIZisFRmAM4UnFMp3fu+OpIbKAwlEiTXrDrv5BZOi8/H
	 XdGmKh13XiHCszY7RN8SaWDgkRFfHZDQKPtruFRG1+xJQUpW46xRaJQJyAYmAgoD5InCF
	 WCpgsS32w62LO4QssdRpV6cmrfXCoI/6D3XJWueIi4QNprt7L63Anb1Pk8bSCSj+QH1Bp
	 +fTeRmyWP3dtg6DEYCPGTWRWrvaZhw5W7HllOV/BQJfl0gxM4+HyUVB2I7tJ8VQsji5zR
	 HcwtRPippVZO/iSCfDxHoZxPzzfDF1CTwA+EUpFtzPlu7vrQB8Kb/tZujDCGJ2O1p+Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=163.com;
	spf=pass smtp.mailfrom=163.com;
	dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=Z2D8lpiQ;
	arc=none smtp.remote-ip=220.197.31.3
X-Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04F38606A327;
	Sun, 15 Nov 2026 16:18:55 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 04F38606A327
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com;
	s=s110527; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=rC
	46ljI1wkzuuDt36qNW3ZBG08s5+InoUkoZUDEJRkM=; b=Z2D8lpiQSkP6DrID3o
	xM0C1qjqrmSPB2pigbVTNwejoLNAqaLAp4jQ7LHsEfALBB/EXm9Omp2RqkNCFglS
	Y+Tom948M8rhnepNNzgAZa2OzGxZlUg2k/DVX9ZjuGlGQbj/7dumrG5lAAgfR4St
	xhLwaRCoXK9PR6taz9CbUhRno=
X-Received: from user-VMware-Virtual-Platform.localdomain (unknown [])
	by gzga-smtp-mtada-g1-1 (Coremail) with SMTP id _____wDnr8BI2_lqw3h9HQ--.52158S2;
	Mon, 16 Nov 2026 00:18:16 +0800 (CST)
X-Cc: netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
X-Mailer: git-send-email 2.43.0
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-CM-TRANSID: _____wDnr8BI2_lqw3h9HQ--.52158S2
X-Coremail-Antispam: 1Uf129KBjvJXoWxJF17Jr17GF4DGFyUJr1xGrg_yoW5JrykpF
	WrAFyDCF4kJF4rG3W7uw40krWY9FWxZFWjgF9rKwsxZrW5ZF47XryUKFya9rW5Ars5XFs2
	yFWUKFnrGFWDJ3JanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2
	9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jlCJPUUUUU=
X-CM-SenderInfo: p2lkv0ljzqjqqrwthudrp/xtbC7Qgicmr520gxwwAA3H