diff mbox series

[net] octeontx2-af: Check return value of nix_get_nixlf before using nixlf

Message ID 1700930098-5483-1-git-send-email-sbhatta@marvell.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] octeontx2-af: Check return value of nix_get_nixlf before using nixlf | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/codegen success Generated files up to date
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers fail 1 blamed authors not CCed: naveenm@marvell.com; 3 maintainers not CCed: naveenm@marvell.com lcherian@marvell.com jerinj@marvell.com
netdev/build_clang success Errors and warnings before: 1142 this patch: 1142
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1142 this patch: 1142
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Subbaraya Sundeep Nov. 25, 2023, 4:34 p.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>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Jakub Kicinski Nov. 28, 2023, 3:02 a.m. UTC | #1
On Sat, 25 Nov 2023 22:04:58 +0530 Subbaraya Sundeep 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")

You need to run the patch thru scripts/get_maintainer,
here you missed CCing Naveen, who authored 967db3529eca.
Also lcherian@marvell.com and jerinj@marvell.com
LMK if these people are no longer at marvell, I can add their
addresses to our ignore list.

Same goes for the pauseparam patch, you'll need to repost the two.
Subbaraya Sundeep Nov. 28, 2023, 3:13 a.m. UTC | #2
Hi Jakub,

>-----Original Message-----
>From: Jakub Kicinski <kuba@kernel.org>
>Sent: Tuesday, November 28, 2023 8:32 AM
>To: Subbaraya Sundeep Bhatta <sbhatta@marvell.com>
>Cc: netdev@vger.kernel.org; linux-kernel@vger.kernel.org;
>davem@davemloft.net; pabeni@redhat.com; edumazet@google.com; Sunil
>Kovvuri Goutham <sgoutham@marvell.com>; Geethasowjanya Akula
><gakula@marvell.com>; Hariprasad Kelam <hkelam@marvell.com>
>Subject: [EXT] Re: [PATCH net] octeontx2-af: Check return value of
>nix_get_nixlf before using nixlf
>
>----------------------------------------------------------------------
>On Sat, 25 Nov 2023 22:04:58 +0530 Subbaraya Sundeep 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")
>
>You need to run the patch thru scripts/get_maintainer, here you missed CCing
>Naveen, who authored 967db3529eca.
>Also lcherian@marvell.com and jerinj@marvell.com LMK if these people are
>no longer at marvell, I can add their addresses to our ignore list.
>
>Same goes for the pauseparam patch, you'll need to repost the two.

Sure will do it.

Thanks,
Sundeep
>--
>pw-bot: cr
diff mbox series

Patch

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);