Message ID | 1701236508-22930-1-git-send-email-sbhatta@marvell.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp137388vqn; Tue, 28 Nov 2023 21:42:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IH6DxYnXlNfB8LNTSoYiPWXnjcuv2sLABTtqLyG2H96ipY4Aj7CmfDD0LSOYdhEfAw67ukz X-Received: by 2002:a05:6870:56a0:b0:1eb:192b:e75b with SMTP id p32-20020a05687056a000b001eb192be75bmr21508769oao.40.1701236534746; Tue, 28 Nov 2023 21:42:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701236534; cv=none; d=google.com; s=arc-20160816; b=ZV7/a/tS4S5M9V2UZFXf0Un7j88JH84ZFNjGJlw4Jb2w2YvSBqAE7XSIwyRyrBETxf 59psGSXejgSVk7AIv7r+LQfd+7u8YL2N93qTuWcz5e6zCL517tpGriQramtEJejF4On/ 51Y6K7GwWMPRzOerzF4BFBBJ32Cc9jf+c0KPt0HJa8lwrrbGJrGDkCpVCIXnDJp2h1Zd zxFTpLubFT6eQw0vfWvuzk+hNul2J8ssYzcZ5JhKzIhDbtrF6TKkm8RBgAanCGAbubwi Lmn/SEmRUImfLW3mqbEu7Qa8O8upj0o429PA8QMxqW5CynPp2g4lJVIcoKL4SQONOE+a VgZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=PsaOol7ocb/iGZfJuZJyDf0wjuc8qFIf2hC77PzevFs=; fh=h3G+JKyrvGTY4IDHl3QNCgCSRyv27XxZoC2f2MnIcCg=; b=DTKFrYqVleb2XoVEq/Xipi8o5JB8qKFifepIjNe93U/XGuAqu//acwdN2tYEoep+t+ aD2djPE2TLPtp1MQzE310RdeDu7pq2pWHuN7SlBQFBkIVts6orchRsSAukO73HhiQ47Y EnpkfLlfnUeyjzXBbVqUdT2+zzWsR1uH6gmFjRABM6rRjGDLK8PJ/CLGKN3ZuzB6IpPR HFfLaHQmljIkZDltDHGAYm4Y6xT6IWqM4OdZeTZ8ASm5pH8cRwHpkESoEkl4IvvjjWqR AxwNhACqBiqmEGvvpEpPo4GImbS9OxIBwV1wmgUVWHO9eZV6UKXai7gz9MNmwdN+78XE Cssg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=gaQuH1lb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id q24-20020a656258000000b005c25a1d3916si13269536pgv.651.2023.11.28.21.42.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 21:42:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=gaQuH1lb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id CB4C480A9B1B; Tue, 28 Nov 2023 21:42:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376952AbjK2FmC (ORCPT <rfc822;kernel.ruili@gmail.com> + 99 others); Wed, 29 Nov 2023 00:42:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229723AbjK2FmA (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 29 Nov 2023 00:42:00 -0500 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDFF1AE; Tue, 28 Nov 2023 21:42:06 -0800 (PST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3AT3jmaU006444; Tue, 28 Nov 2023 21:41:59 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-type; s=pfpt0220; bh=PsaOol7ocb/iGZfJuZJyDf0wjuc8qFIf2hC77PzevFs=; b=gaQuH1lbTAHggIpox5x9SWpbbZ+ZT9V6jqYWxGBsonWiu66v5HvL8nnzxbkg4MTSW2Vp +DF81TNjvqn3l96bhoSHTDvQ9M9UnBc3a4IuMD5ebCFmDgwdyXCw+HkiiUeaKfB6fCIh 7wrvSqDq65lSRtQAQOG7/DC7lpxnellGbbWzo7vYyFhuKW02ZIaYLfWIiG4YCSDhkSmL TkFGcid58eFM76lOv+EQp8CA0blzE5F/XZgbqQQ0B1H6qtam622K9HlzcUM+DKH6J2/j DoK9SjDjeyn6q3o6LiiOiaQIH1kYajcahtRpAll2v1cT/nxPPJEsy5Dp/LJL60ijs/3O IA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3una4dmhgw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 28 Nov 2023 21:41:59 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 28 Nov 2023 21:41:57 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 28 Nov 2023 21:41:57 -0800 Received: from hyd1358.marvell.com (unknown [10.29.37.11]) by maili.marvell.com (Postfix) with ESMTP id C4A4C3F7048; Tue, 28 Nov 2023 21:41:51 -0800 (PST) From: Subbaraya Sundeep <sbhatta@marvell.com> To: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> CC: <kuba@kernel.org>, <davem@davemloft.net>, <pabeni@redhat.com>, <edumazet@google.com>, <sgoutham@marvell.com>, <gakula@marvell.com>, <hkelam@marvell.com>, <lcherian@marvell.com>, <jerinj@marvell.com>, <naveenm@marvell.com>, Subbaraya Sundeep <sbhatta@marvell.com> Subject: [PATCH v3 net] octeontx2-af: Check return value of nix_get_nixlf before using nixlf Date: Wed, 29 Nov 2023 11:11:48 +0530 Message-ID: <1701236508-22930-1-git-send-email-sbhatta@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-GUID: idnKMRQx-GUERl9VfTFrPLJ75Zi3pvKj X-Proofpoint-ORIG-GUID: idnKMRQx-GUERl9VfTFrPLJ75Zi3pvKj X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-29_03,2023-11-27_01,2023-05-22_02 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 28 Nov 2023 21:42:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783874947629453894 X-GMAIL-MSGID: 1783875800494588476 |
Series |
[v3,net] octeontx2-af: Check return value of nix_get_nixlf before using nixlf
|
|
Commit Message
Subbaraya Sundeep
Nov. 29, 2023, 5:41 a.m. UTC
If a NIXLF is not attached to a PF/VF device then
nix_get_nixlf function fails and returns proper error
code. But npc_get_default_entry_action does not check it
and uses garbage value in subsequent calls. Fix this
by cheking the return value of nix_get_nixlf.
Fixes: 967db3529eca ("octeontx2-af: add support for multicast/promisc packet replication feature")
Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
---
v3 changes:
Added version history
v2 changes:
CCed AF driver maintainers and original author of patch
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
Comments
Hello: This patch was applied to netdev/net.git (main) by David S. Miller <davem@davemloft.net>: On Wed, 29 Nov 2023 11:11:48 +0530 you wrote: > If a NIXLF is not attached to a PF/VF device then > nix_get_nixlf function fails and returns proper error > code. But npc_get_default_entry_action does not check it > and uses garbage value in subsequent calls. Fix this > by cheking the return value of nix_get_nixlf. > > Fixes: 967db3529eca ("octeontx2-af: add support for multicast/promisc packet replication feature") > Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com> > > [...] Here is the summary with links: - [v3,net] octeontx2-af: Check return value of nix_get_nixlf before using nixlf https://git.kernel.org/netdev/net/c/830139e7b691 You are awesome, thank you!
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c index 16cfc80..f658058 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c @@ -389,7 +389,13 @@ static u64 npc_get_default_entry_action(struct rvu *rvu, struct npc_mcam *mcam, int bank, nixlf, index; /* get ucast entry rule entry index */ - nix_get_nixlf(rvu, pf_func, &nixlf, NULL); + if (nix_get_nixlf(rvu, pf_func, &nixlf, NULL)) { + dev_err(rvu->dev, "%s: nixlf not attached to pcifunc:0x%x\n", + __func__, pf_func); + /* Action 0 is drop */ + return 0; + } + index = npc_get_nixlf_mcam_index(mcam, pf_func, nixlf, NIXLF_UCAST_ENTRY); bank = npc_get_bank(mcam, index);