Skip to content

Commit 830139e

Browse files
Subbaraya Sundeepdavem330
Subbaraya Sundeep
authored andcommitted
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: 967db35 ("octeontx2-af: add support for multicast/promisc packet replication feature") Signed-off-by: Subbaraya Sundeep <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9572c94 commit 830139e

File tree

1 file changed

+7
-1
lines changed
  • drivers/net/ethernet/marvell/octeontx2/af

1 file changed

+7
-1
lines changed

drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,13 @@ static u64 npc_get_default_entry_action(struct rvu *rvu, struct npc_mcam *mcam,
389389
int bank, nixlf, index;
390390

391391
/* get ucast entry rule entry index */
392-
nix_get_nixlf(rvu, pf_func, &nixlf, NULL);
392+
if (nix_get_nixlf(rvu, pf_func, &nixlf, NULL)) {
393+
dev_err(rvu->dev, "%s: nixlf not attached to pcifunc:0x%x\n",
394+
__func__, pf_func);
395+
/* Action 0 is drop */
396+
return 0;
397+
}
398+
393399
index = npc_get_nixlf_mcam_index(mcam, pf_func, nixlf,
394400
NIXLF_UCAST_ENTRY);
395401
bank = npc_get_bank(mcam, index);

0 commit comments

Comments
 (0)