From nobody Tue Jun 16 04:06:18 2026 Received: from mx0a-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (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 7A47F2DF13A; Thu, 16 Apr 2026 03:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776311734; cv=none; b=j70ZDv7UvAvDgP8fcSLOlvsscjRodYq+MdMFyBi9di6wAA7voPn6njMxJ/KyIiShhNIcXZRZia+cTt16iLThYGtefgWCOhVIcuOnmhMc6k0cXYV6MfhJx5lVvOZniMquavl/ybCjenKPSuNA3JXGvGKQj8d2b2N5zbhIZmmTkhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776311734; c=relaxed/simple; bh=rQrs8lLPk7fTA2mg+4gyQpXuS/QFkHUdLLfDb2MIflg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=mIxHfCYT5i9nBisaz3HDStmivQeOLTM9iUZ3+LSTI3jfUY/CCI6+2mj74Xxx2c8magiw7EzOLIs+wTO8wMy+un5hFGQkD6vgYRGm0A58iClGdPGDTb9Er6IeKHN7ckv3V8prebtD12HrMFB6mr7fNMo2yEnlIT2qJmiGW8RZyUk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=bblGHbj9; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="bblGHbj9" Received: from pps.filterd (m0431384.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63FNT44u066774; Wed, 15 Apr 2026 20:55:11 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=0 J26ByA48pTyYzUFPE0k9D22JfJYQgTDr3R5J/ygeGA=; b=bblGHbj9h0iJ/rNkR f1iJvPn8xZMKdYPuFrwWQlzPF/7dNWTWXJknh3n4mvNeW+Vegd5leFLAFhxvQgm4 y61DWULT2W6on9zcTwHyoPrw9lB07jkCSLv6Y5jFxkNl1a17szbrxuIMs6vLomcD ItYXpkkDZBRJ8/4VYtcXRj/qleD1HYEp++bcGqWD12Y98QEwhPdo9WZIHFEbGyAQ HQ+xcyDXz6px6vSGzwH5h+ceUlO2StAbX7gKXbchkYS7NzWeHGIsicaHaSGlDm0r fPpa3YB16bNmU1i2wjNT7NW06sD3nkQel2WLDaokhWSQr5gzhBgMBxEFHMT2A2l+ 3KSSQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 4djmcugdvr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Apr 2026 20:55:11 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Wed, 15 Apr 2026 20:55:10 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Wed, 15 Apr 2026 20:55:10 -0700 Received: from rkannoth-OptiPlex-7090.. (unknown [10.28.36.165]) by maili.marvell.com (Postfix) with ESMTP id BBF403F7079; Wed, 15 Apr 2026 20:55:06 -0700 (PDT) From: Ratheesh Kannoth To: , CC: , , , , , , , Ratheesh Kannoth , "Dan Carpenter" Subject: [PATCH net 1/3] octeontx2-af: npc: cn20k: Handle npc_mcam_idx_2_key_type() failures Date: Thu, 16 Apr 2026 09:23:50 +0530 Message-ID: <20260416035352.333808-2-rkannoth@marvell.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260416035352.333808-1-rkannoth@marvell.com> References: <20260416035352.333808-1-rkannoth@marvell.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-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDAzMyBTYWx0ZWRfXyi+SB8lyRlNx wWJ0sOOcVY17ntGI30eMUrVdOGTiGZPowRWxF6pbh/nmk7bluaZEK8AwnZdJBsQCJSjs2IL1uez fq6a9LfWKasRL6p/cKh3t1kyxz/qpdx8izgqyC795Ls/JP5AVI/HPtRHKdR1/Skk56KxIH7I4Cv dNmP+paEte9N4FLrTe6QZvNYfYru3RMXII6x1nb+G3Prhe2lecO5vJ3XrEWdM4tdS5nzGUxCh6M HhKj01Hb7thIYvhTWH+KQsxkfkBKzozDc5CR4oUBxD4JLCSyZ+OEA+RtNPEpU0XhYi1aCqfQRCw 9fdWeOxxT5p6fEFNOsZeUOxQQ44+NbVT0SsplolDIYAkL7JJ1plVAG1s5424DkSIZLVwTo3iwW+ 9uejvWxsBhu4P0LHFvh1cbusR66Jx64BhQD8RSmh8KgH4XT7VVHYGLALzd/LZxYjtOXI0sug+T+ Yn8ZiVJpC4zNkwDbIeQ== X-Proofpoint-GUID: dkIffXavJSnnh24SJBn5p7iPLvREwjZD X-Proofpoint-ORIG-GUID: dkIffXavJSnnh24SJBn5p7iPLvREwjZD X-Authority-Analysis: v=2.4 cv=F4hnsKhN c=1 sm=1 tr=0 ts=69e05d9f cx=c_pps a=rEv8fa4AjpPjGxpoe8rlIQ==:117 a=rEv8fa4AjpPjGxpoe8rlIQ==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=l0iWHRpgs5sLHlkKQ1IR:22 a=TtqV-g6YmW1Jfm2GSLaY:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=M5GUcnROAAAA:8 a=uyHcWPyfkJeEmAZy9ZsA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_01,2026-04-13_04,2025-10-01_01 Content-Type: text/plain; charset="utf-8" npc_mcam_idx_2_key_type() can fail; ignoring its return value left kw_type unchecked in MCAM enable, configure, copy, and read paths. Return early on error so we do not program or interpret MCAM state with an invalid key type. CC: Dan Carpenter Fixes: 6d1e70282f76 ("octeontx2-af: npc: cn20k: Use common APIs") Link: https://lore.kernel.org/netdev/adiQJvuKlEhq2ILx@stanley.mountain/ Signed-off-by: Ratheesh Kannoth --- .../ethernet/marvell/octeontx2/af/cn20k/npc.c | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/driver= s/net/ethernet/marvell/octeontx2/af/cn20k/npc.c index 7291fdb89b03..2fcd0ee2b1e1 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c @@ -808,7 +808,9 @@ npc_cn20k_enable_mcam_entry(struct rvu *rvu, int blkadd= r, u64 cfg, hw_prio; u8 kw_type; =20 - npc_mcam_idx_2_key_type(rvu, index, &kw_type); + if (npc_mcam_idx_2_key_type(rvu, index, &kw_type)) + return; + if (kw_type =3D=3D NPC_MCAM_KEY_X2) { cfg =3D rvu_read64(rvu, blkaddr, NPC_AF_CN20K_MCAMEX_BANKX_CFG_EXT(mcam_idx, @@ -1052,10 +1054,12 @@ void npc_cn20k_config_mcam_entry(struct rvu *rvu, i= nt blkaddr, int index, int kw =3D 0; u8 kw_type; =20 + if (npc_mcam_idx_2_key_type(rvu, index, &kw_type)) + return; + /* Disable before mcam entry update */ npc_cn20k_enable_mcam_entry(rvu, blkaddr, index, false); =20 - npc_mcam_idx_2_key_type(rvu, index, &kw_type); /* CAM1 takes the comparison value and * CAM0 specifies match for a bit in key being '0' or '1' or 'dontcare'. * CAM1 =3D 0 & CAM0 =3D 1 =3D> match if key =3D 0 @@ -1132,8 +1136,13 @@ void npc_cn20k_copy_mcam_entry(struct rvu *rvu, int = blkaddr, u16 src, u16 dest) =20 dbank =3D npc_get_bank(mcam, dest); sbank =3D npc_get_bank(mcam, src); - npc_mcam_idx_2_key_type(rvu, src, &src_kwtype); - npc_mcam_idx_2_key_type(rvu, dest, &dest_kwtype); + + if (npc_mcam_idx_2_key_type(rvu, src, &src_kwtype)) + return; + + if (npc_mcam_idx_2_key_type(rvu, dest, &dest_kwtype)) + return; + if (src_kwtype !=3D dest_kwtype) return; =20 @@ -1188,7 +1197,8 @@ void npc_cn20k_read_mcam_entry(struct rvu *rvu, int b= lkaddr, u16 index, int kw =3D 0, bank; u8 kw_type; =20 - npc_mcam_idx_2_key_type(rvu, index, &kw_type); + if (npc_mcam_idx_2_key_type(rvu, index, &kw_type)) + return; =20 bank =3D npc_get_bank(mcam, index); index &=3D (mcam->banksize - 1); --=20 2.43.0 From nobody Tue Jun 16 04:06:18 2026 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (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 C93182F8BC3; Thu, 16 Apr 2026 03:55:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776311735; cv=none; b=Owpa47NoZ+A0vPxRPSmQ8FW/M6C1w8fVewKB8bYCVRTyt8BTCnq3EXhlU0NW3thdEBoqZfW+gh/UvGdopbRHaOodMyAX+lHmPJw2yKR4Ujbrg1dyenumR5fbovAUb4qiOwoMDUm7d1yMYTw9FAnH+ZF29Ue5hz/qslgrdfPaaGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776311735; c=relaxed/simple; bh=p0Hi5KhG7hcLhB2XwVYaWw7oEBl8Qu4UyipOQvs+Ris=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=QZHPY6rugENA5orf+UMRqIutEHAXLZbT7ddd1OZ1bu7AebE80n/ghWLPA2pojLSKOUCT0C+YzluSbweyyUsKd/prEhIWQtpGSQdSTfVqWWpK4FU/rgAwiJi6VuIiRHEZgvI5htdqXyTFm8FJL66QjukCS8Yb05N5/GOnGnsKnR4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=H3CWcjGN; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="H3CWcjGN" Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63FLRNEh431389; Wed, 15 Apr 2026 20:55:16 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=e Ju8pcT/zGuvuUykAuGSa5f0qgCTaSf+tMvhssydGEk=; b=H3CWcjGNsobb4uBG8 0laAzNAjN5c473nycHEYDk0kXvr7rxlNSkTRReERurajLAg40JQmCi3dGxJk54/j pSHGIRf0XlQ3d47FbMoYjy7HrW0AHryxlXnpDZhUHn2dbBFBizcv0wtnfEX4/Zu5 2a5zoHkKmpzrukIRd2afVDYA2/rKh6UCmgVJsd3IlMO+9q/4v6Fm6QLXklTBpRhV Tq8H5BYtCDJYgoXN8szql+PBFvfvRB9kMekMJwNWAkksRljtCENoCmkuVfbfkqLn R9IZgjtPpRnXmBasVmTExRIDY+JmwSiJQlogi4na4OxugeX/a6Lg0XNtMPyWwaaT AJ3IQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 4dh84n6vuk-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Apr 2026 20:55:16 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Wed, 15 Apr 2026 20:55:14 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Wed, 15 Apr 2026 20:55:14 -0700 Received: from rkannoth-OptiPlex-7090.. (unknown [10.28.36.165]) by maili.marvell.com (Postfix) with ESMTP id 055CC3F7079; Wed, 15 Apr 2026 20:55:10 -0700 (PDT) From: Ratheesh Kannoth To: , CC: , , , , , , , Ratheesh Kannoth , "Dan Carpenter" Subject: [PATCH net 2/3] octeontx2-af: npc: cn20k: Drop debugfs_create_file() error checks in init Date: Thu, 16 Apr 2026 09:23:51 +0530 Message-ID: <20260416035352.333808-3-rkannoth@marvell.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260416035352.333808-1-rkannoth@marvell.com> References: <20260416035352.333808-1-rkannoth@marvell.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-Authority-Analysis: v=2.4 cv=B7OJFutM c=1 sm=1 tr=0 ts=69e05da4 cx=c_pps a=rEv8fa4AjpPjGxpoe8rlIQ==:117 a=rEv8fa4AjpPjGxpoe8rlIQ==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=l0iWHRpgs5sLHlkKQ1IR:22 a=QXcCYyLzdtTjyudCfB6f:22 a=5dRrolKJAAAA:8 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=M5GUcnROAAAA:8 a=1ymndBUdME0ty6P6ZmIA:9 a=y3-2bcJ53AEkEa81XYCb:22 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-GUID: g_dJhIxtZODVR3PcEaXyknZCj0rH51H0 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDAzMyBTYWx0ZWRfXyBZTvtE4SqQT XtDRShjZHN1gCk5w1p7fXqR3wpRG1YfObRGleCVcK0ERolpF07w5a3HeubILTORt8AozTHFzowc alVGKjeQVpsuL+QcQ4ymYqz1wSmfQ4XVeDQC8pj09msChW4N8OPzM/cx6/gTAP4FpPb4lXjqKJf BaorBZiXw4mY+cf9g72qEPBlGO53in8RRGffLpiSOH3IuX0u4w1ltA1+rW901rLdJMer5C6sZvy WPgda4BHg7/C74kcsuMIO3Y0MA7Kbxgi4OJwJHq7lFmXlXMj3NYmBsxCMphXZRmkRWvjOlqJGnh r1XDRCkordOBs74YY4U4nORFe8gY2ChH1MIMxhPROdio2iCsKP4vhOnu/X+e1kCx1rhaocnfX2B gETD4MEpE6osg7xQV341tv/sKyCgtMJJ/0AuC+8kfhxANiY5HNYdccs58x6l8MiauPtHRJwhFED KQcTS20O85Ze7Z0tw7g== X-Proofpoint-ORIG-GUID: g_dJhIxtZODVR3PcEaXyknZCj0rH51H0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_01,2026-04-13_04,2025-10-01_01 Content-Type: text/plain; charset="utf-8" debugfs is not intended to be checked for allocation failures the way other kernel APIs are: callers should not fail probe or subsystem init because a debugfs node could not be created, including when debugfs is disabled in Kconfig. Replacing NULL checks with IS_ERR() checks is similarly wrong for optional debugfs. Remove dentry checks and -EFAULT returns from npc_cn20k_debugfs_init(). https://staticthinking.wordpress.com/2023/07/24/debugfs-functions-are-not-s= upposed-to-be-checked/ CC: Dan Carpenter Link: https://lore.kernel.org/netdev/adjNGPWKMOk3KgWL@stanley.mountain/ Fixes: 528530dff56b ("octeontx2-af: npc: cn20k: add debugfs support") Signed-off-by: Ratheesh Kannoth Reviewed-by: Simon Horman --- .../marvell/octeontx2/af/cn20k/debugfs.c | 33 ++++++------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c b/dr= ivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c index 3debf2fae1a4..6f13296303cb 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/debugfs.c @@ -249,34 +249,21 @@ DEFINE_SHOW_ATTRIBUTE(npc_defrag); int npc_cn20k_debugfs_init(struct rvu *rvu) { struct npc_priv_t *npc_priv =3D npc_priv_get(); - struct dentry *npc_dentry; =20 - npc_dentry =3D debugfs_create_file("mcam_layout", 0444, rvu->rvu_dbg.npc, - npc_priv, &npc_mcam_layout_fops); + debugfs_create_file("mcam_layout", 0444, rvu->rvu_dbg.npc, + npc_priv, &npc_mcam_layout_fops); =20 - if (!npc_dentry) - return -EFAULT; + debugfs_create_file("mcam_default", 0444, rvu->rvu_dbg.npc, + rvu, &npc_mcam_default_fops); =20 - npc_dentry =3D debugfs_create_file("mcam_default", 0444, rvu->rvu_dbg.npc, - rvu, &npc_mcam_default_fops); + debugfs_create_file("vidx2idx", 0444, rvu->rvu_dbg.npc, + npc_priv, &npc_vidx2idx_map_fops); =20 - if (!npc_dentry) - return -EFAULT; + debugfs_create_file("idx2vidx", 0444, rvu->rvu_dbg.npc, + npc_priv, &npc_idx2vidx_map_fops); =20 - npc_dentry =3D debugfs_create_file("vidx2idx", 0444, rvu->rvu_dbg.npc, - npc_priv, &npc_vidx2idx_map_fops); - if (!npc_dentry) - return -EFAULT; - - npc_dentry =3D debugfs_create_file("idx2vidx", 0444, rvu->rvu_dbg.npc, - npc_priv, &npc_idx2vidx_map_fops); - if (!npc_dentry) - return -EFAULT; - - npc_dentry =3D debugfs_create_file("defrag", 0444, rvu->rvu_dbg.npc, - npc_priv, &npc_defrag_fops); - if (!npc_dentry) - return -EFAULT; + debugfs_create_file("defrag", 0444, rvu->rvu_dbg.npc, + npc_priv, &npc_defrag_fops); =20 return 0; } --=20 2.43.0 From nobody Tue Jun 16 04:06:18 2026 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (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 BD6E230EF7D; Thu, 16 Apr 2026 03:55:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776311737; cv=none; b=g1Tc+ZmN0cXB6CZkJx/7t0vcA1t6I9tb3Sa0HdyGDuHF0aKopENxBEHXEbWmDJcG1lrHqMCCoCRNj2tqn/DiNpNofIHCn+f+oa7TplLuOH3L9mKJp1U7piYRUNLJbRvBU8F5NBziTmGvLHi4ankC0XEKXkx9KhgMjbGIgOPNdE8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776311737; c=relaxed/simple; bh=pqimf3NDcu8MKTJUALvHFCZn88kDi6+MlZ16MDoICG0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=BTqDwqkVnP8in7kNkm46RsAAjqCf32MexwVJ9cuD7uxUjQC2N0AAo2WmIVqVQ2lC4B/Nqj/wyzPB4SUWrmf2x9GHXO16Pkz82RQgPZJCEZKnnXumowe3o5UMWMZw69I8+MIsrhoDPl4bJoewyoZPFvDXgHi4g0icr137gxzzeNY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=eof64qwL; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="eof64qwL" Received: from pps.filterd (m0431383.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63FLclaF3278469; Wed, 15 Apr 2026 20:55:20 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=6 Pf98AgeLQwARDEu+E4vD3tnol9QnT2Zmed0+plww80=; b=eof64qwL1hgIggPJ7 QNNcCHCoNo6wtCoBjUrxhodgmGrRrJQQDGdmmb5owr7MwqrDQe2HqRXza9iuzybX 3AAx6jIh9PqECww38cXyAzfaXiC4FeRRs7/u8/EbNgGEvH402NOx72i9828yhsUz 8WsCW0ewCPGoSmFguVnlwD8ik1vor4OjhBtVnMKa/M2TLcyFyCTYRBeYfxfsxM8L 4QKYkF59n0VvRIzFDtO5XLbPK6hut8nAoIPAirNR2AmW6nKRb0ThfZ5i1gl5PMB0 njx1aY93rUPk9weniE/0nWY0vfm0QA2nlKYi/YNvaP/XgM+IcbBCf4nY58H6sRDh To73g== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 4djjr6gmre-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 Apr 2026 20:55:20 -0700 (PDT) Received: from DC5-EXCH05.marvell.com (10.69.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Wed, 15 Apr 2026 20:55:19 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Wed, 15 Apr 2026 20:55:19 -0700 Received: from rkannoth-OptiPlex-7090.. (unknown [10.28.36.165]) by maili.marvell.com (Postfix) with ESMTP id 423A03F707E; Wed, 15 Apr 2026 20:55:14 -0700 (PDT) From: Ratheesh Kannoth To: , CC: , , , , , , , Ratheesh Kannoth , "Dan Carpenter" Subject: [PATCH net 3/3] octeontx2-af: npc: cn20k: Return error when defrag rollback free fails Date: Thu, 16 Apr 2026 09:23:52 +0530 Message-ID: <20260416035352.333808-4-rkannoth@marvell.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260416035352.333808-1-rkannoth@marvell.com> References: <20260416035352.333808-1-rkannoth@marvell.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-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDE2MDAzMyBTYWx0ZWRfX+XAkFHAxNr2C wKwia8xiaq5HPhy9/Om5JnWbIfeDBUOX5LUkalaWDr3g1T86d2YTnQzjSQygBsL7CgIpN4yHoG/ hn7edZrbTDadqWgoyGb2B46Ej+LWJ22vRTCtUQfW4I4C0B1GwSMUnhnRj5jEjJhNIl7AK1hCcWr zuqELs6oXR4HX9nuGMtYSPJQgBYL0JExMYjuWnl+JU+vWvsx2PCcCOTJgfvH+u8rau7aiiG6qv5 JaMn+ev/xJAEjHNegpxVWmLMGzN9Ufqp+r49H1ZVLfsERIfmHM0p+duL/X3NE+nFoQwM+GmK9eZ pOuZ1mB6dI8ju6yaYa++UIj2z6ayP1atBJYhRI/tHLIRpYbaAuAa48sSgejFZQovoIvV6UezB4V Y7zXcyXyWpJA8Wea17ZuAYsoD72AIInb/2AXDu3FnRPQPoG77rEHVcdzpYy8RhfcIAlez9lhEB2 8OnbjJAECVTPUwsnySw== X-Proofpoint-ORIG-GUID: oGrzF7P7vvpBl2cfJbMvDUEzgGudtwq5 X-Authority-Analysis: v=2.4 cv=ALcTSjp/ c=1 sm=1 tr=0 ts=69e05da8 cx=c_pps a=rEv8fa4AjpPjGxpoe8rlIQ==:117 a=rEv8fa4AjpPjGxpoe8rlIQ==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=l0iWHRpgs5sLHlkKQ1IR:22 a=qit2iCtTFQkLgVSMPQTB:22 a=VwQbUJbxAAAA:8 a=pGLkceISAAAA:8 a=M5GUcnROAAAA:8 a=LAwRvmMFHPUKmpe1hlIA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-GUID: oGrzF7P7vvpBl2cfJbMvDUEzgGudtwq5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-16_01,2026-04-13_04,2025-10-01_01 Content-Type: text/plain; charset="utf-8" In npc_defrag_alloc_free_slots(), the fail_free_alloc rollback loop frees previously allocated MCAM entries after a partial allocation failure. If __npc_subbank_free() fails, we break out of the loop but rc was still zero from the successful npc_mcam_idx_2_subbank_idx() lookup, so the function incorrectly returned success. Set rc to -EFAULT so the failure is visible to callers. CC: Dan Carpenter Link: https://lore.kernel.org/netdev/adjNJEpILRZATB2N@stanley.mountain/ Fixes: 645c6e3c1999 ("octeontx2-af: npc: cn20k: virtual index support") Signed-off-by: Ratheesh Kannoth --- drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/driver= s/net/ethernet/marvell/octeontx2/af/cn20k/npc.c index 2fcd0ee2b1e1..df192729ac1d 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c @@ -3541,6 +3541,7 @@ static int npc_defrag_alloc_free_slots(struct rvu *rv= u, dev_err(rvu->dev, "%s: Error to free mcam idx=3D%u\n", __func__, save[i]); + rc =3D -EFAULT; break; } } --=20 2.43.0