🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26938

[PATCH net] octeontx2-pf: Fix potential SQ buffer leaks on allocation failure

#26938
From: Guangshuo Li
Date: Fri, 04 Dec 2026 13:02
37 lines
9641 bytes
SQ aura setup can fail after allocating buffer pointer arrays and
buffers for earlier queues. Its caller takes the RQ cleanup path and
does not release these SQ allocations.

Free the recorded SQ buffers and their arrays before returning the
allocation error. Leave aura and pool teardown to the existing caller.

This issue was found by our static analysis tool under development.

Fixes: caa2da34fd25 ("octeontx2-pf: Initialize and config queues")
Signed-off-by: Guangshuo Li <liguangshuo@mail.sdu.edu.cn>
---
 drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
index b11389a841d1..caccc3b2878f 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
@@ -1610,6 +1610,14 @@ int otx2_sq_aura_pool_init(struct otx2_nic *pfvf)
 	}
 
 err_mem:
+	if (err) {
+		otx2_sq_free_sqbs(pfvf);
+		for (qidx = 0; qidx < hw->non_qos_queues; qidx++) {
+			sq = &qset->sq[qidx];
+			kfree(sq->sqb_ptrs);
+			sq->sqb_ptrs = NULL;
+		}
+	}
 	return err ? -ENOMEM : 0;
 
 fail:

base-commit: 24a19b953e2a3d0ea5a8c4951a0ab8f32720c907
Technical Details
Message-ID: <20261204130235.2418526-1-liguangshuo@mail.sdu.edu.cn>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377370-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377370-linux-kernel-netdev=dewy.ru
From: liguangshuo@mail.sdu.edu.cn (Guangshuo Li)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net] octeontx2-pf: Fix potential SQ buffer leaks on allocation failure
Date: Fri,  4 Dec 2026 21:02:35 +0800
Organization: Usenet Network
Message-ID: <20261204130235.2418526-1-liguangshuo@mail.sdu.edu.cn>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2767728"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Y9fHby4AMs2MegKYcB5UBdUp+sY= sha256:yFhhcrNLaus0h81BL+dDRC7wwF4507EKCpjUMJWLZ90=
	sha1:sjZ/ZvxMT7HoTNi4oYDKPYxmGW8= sha256:brbcDG6jymFrsZjQyyef0Sj/RTDVfdPJSkVt9miU4Xo=
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 CFCEA117BF9; Fri,  4 Dec 2026 16:03:09 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.298
X-Spam-Status: No, score=-3.298 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key)
	header.d=mail.sdu.edu.cn
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 CIAV1Oa2WE2o;
	Fri,  4 Dec 2026 16:03:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377370-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=mail.sdu.edu.cn
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 47555117BF7; Fri,  4 Dec 2026 16:02:48 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id F3AF03EEBB; Fri,  4 Dec 2026 13:02:44 +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=1796389364;
	b=DqjmRJc28aEA6IktwruWRFVwXiAvYnJ8WcfBpyzisU59pG35z2rvFpHDFJXrT4yA5/cX
	 6ceJlrPfOyOVB8+/q32DaccuvyW4h1XjZZMwnd6aHTjuTXh+6Y0QUnAI6/iNaE2xZK/lr
	 LcTZ1eztsy6VmTlm5vGsHTfIbR15ZK9hprUdGHYlGwEOv832Iue7vhoZ/SmybO6h+ZcgC
	 XQnS9gLX+8PYzkX5YuC4hlBfd1wXJqWrgaPKTXiILSj9R6DAzZKh0W+ilKiKNfaghiLZi
	 5xfIrjMPVfmWAnXpjs8cQ8UlOiAEIG/tkdKrBoGXAvPOclQN7F0LfmOZgLwhgH0LXxg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796389364;
	h=X-Original-To:Received:DMARC-Filter: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-HM-Tid:X-HM-MType:X-HM-Spam-Status:
	 DKIM-Signature;
	bh=97seJom/mFfLfy1jMrMEF7vUIDAoti0QLJ3ffeRFAQg=;
	b=XuyVOxCI/8J759/yNVDvo7cnJGJjldlYVfImycrGVeyHnsUqlKpFM1pi31oZgE4ksTLT
	 i/PlvHzZkG/pGd5fuE1iOII7fh0Aop1i4fcUO6EEHd9mI8SfSxTtwCe4VDOQZk+7wO2p3
	 4aDAl9N/V+OzLgAev1LwhRlB3s1llNbjkPzdGZWsxJlAB9g36S4niyCbgJuamesyh5zqI
	 iHNKGbmCbn3Bggj1Wk0gnnMRt2i6I/9A8ErQt/HRjuoFlncRwc+YsnFlyq/jdhZYxc4ev
	 Mhx34DBYIvAreYukWyADxxrG2yKXJGeOGjOQ3OhblMVflTdrUckUCeOKFVqZfs1VgcQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mail.sdu.edu.cn header.i=@mail.sdu.edu.cn header.a=rsa-sha256 header.s=default header.b=VQHHDzh+;
	dmarc=pass header.from=mail.sdu.edu.cn;
	spf=pass smtp.mailfrom=mail.sdu.edu.cn;
	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 CC298606A338;
	Fri,  4 Dec 2026 13:02:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=mail.sdu.edu.cn header.i=@mail.sdu.edu.cn header.a=rsa-sha256 header.s=default header.b=VQHHDzh+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=45.254.49.197
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796389364;
	b=RrS/mcSv8Qz/vF8rHJltt2Wz8LQzZr+kozMx8ZWcZ+R3IWjJNoZf81xjGQ2KljhtFcFG
	 ANQf55QZUpDZlrJyIqVfSmC3XXJgYizz5vS56wD9/mTi/F/pOAgysPbaUdrETWXS12q0h
	 AHmmb1U5b9X5k65aKPSVw1ZurhVwEpurFKxLVfBDMo6ItdXQurPgzQKeQ9PXdF373i5UU
	 pyfV/lWUVZoyRrDntBNWY0e6ygzXeatm7zBiG7CtCCZ850WIpCTSXW1z+2JOkQ+MOSQuz
	 gCFqGY9i1juYBerSs8ovyPz6gt4zJAuWUQSvhZ++zDG/upa4p9GoBSgZZpfDbQAANQQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796389364;
	h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 MIME-Version:Content-Transfer-Encoding:X-HM-Tid:X-HM-MType:
	 X-HM-Spam-Status:DKIM-Signature;
	bh=97seJom/mFfLfy1jMrMEF7vUIDAoti0QLJ3ffeRFAQg=;
	b=vWCesAr3SdmJhGTvRuIAzxzP6B2MnCH8AMZ9MFfvAsMkDaSqxe7NDvygcCpL008BX4GW
	 G7ssgtc/rvHqm1DgxpcicHmpBTvvUwJF7kRckGD+9Hyhv3E4v9FhIShX3kV8+kV9YWpVg
	 ASGaXA+diq8uhz1r4f3rG0+u1RhnRJ/8gbjtuoCzbmL07Epo60HMSYCGHVnVTXkK24rzw
	 wGJ3ZSB7QE0wRM9Y0PWtzlfFAxVHRGys5hSfQkCq2TfnAK64DxIP+VzawXHnn/cqj6alA
	 y40VDFNhdsb7V2RSnw2DoD7R3GAtHyF/r9iQF1BV5CmXXcLIJh/ka3LEtN03ab4Cmhw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=mail.sdu.edu.cn;
	spf=pass smtp.mailfrom=mail.sdu.edu.cn;
	dkim=pass header.d=mail.sdu.edu.cn header.i=@mail.sdu.edu.cn header.a=rsa-sha256 header.s=default header.b=VQHHDzh+;
	arc=none smtp.remote-ip=45.254.49.197
X-Received: from mail-m49197.qiye.163.com (mail-m49197.qiye.163.com [45.254.49.197])
	(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 B03B5606A322;
	Fri,  4 Dec 2026 13:02:40 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B03B5606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mail.sdu.edu.cn
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mail.sdu.edu.cn
X-Received: from lgs.. (unknown [101.76.249.61])
	by smtp.qiye.163.com (Hmail) with ESMTP id 6fc24d822;
	Fri, 4 Dec 2026 21:02:36 +0800 (GMT+08:00)
X-Cc: gakula@marvell.com,
	rkannoth@marvell.com,
	sbhatta@marvell.com,
	bbhushan2@marvell.com,
	andrew+netdev@lunn.ch,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	netdev@vger.kernel.org,
	linux-kernel@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-HM-Tid: 0aa24126438703a1kunmf731e0ed4d539
X-HM-MType: 10
X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly
	tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkaGhoaVh0YGUxMSxkYT08aQlYeHw
	5VEwETFhoSFyQUDg9ZV1kYEgtZQVlKS0pVTE1VSU9CVU1KWVdZFhoPEhUdFFlBWU9LSFVKS0lITk
	NDVUpLS1VLWQY+
X-DKIM-Signature: a=rsa-sha256;
	b=VQHHDzh+4UdDin7ZPhDd00KygRJjNFhzAC+vabPvJBUpfOrks/+hmYijVcOAnubwszLAuNrkLGafVCSQnj0k4ppR6eQOapsVdHPmNF9rq9Ajr5VjlAVCnCB7/VRqkyEDfSD449fk+zxQRXjxWR7/fe79J/kMPfuvVbfwtssu6YI=; c=relaxed/relaxed; s=default; d=mail.sdu.edu.cn; v=1;
	bh=97seJom/mFfLfy1jMrMEF7vUIDAoti0QLJ3ffeRFAQg=;
	h=date:mime-version:subject:message-id:from;