Skip to contentSkip to conversation

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

PATCH Applied Subbaraya Sundeep 2 participants 2 messages Nov 29, 2023 – Dec 1, 2023

Subsystems (3)
lore
Share & tools
lore

Subbaraya Sundeep

author maintainer
#0 lore raw

PATCH v3 1/1 octeontx2-af: Check return value of nix_get_nixlf before using nixlf

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

---
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(-)
drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c +7 -1
index 16cfc80..f658058 100644
@@ -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);
Signature · 1 line
2.7.4
#1 lore raw
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:

Quoted 10 lines · 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")

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html