[PATCH v2] net/nfp: fix port action core dump
Chaoyong He
chaoyong.he at corigine.com
Mon Jul 8 05:12:09 CEST 2024
From: Long Wu <long.wu at corigine.com>
The app will be destroyed if add a port flow action which its
destination port id is invalid.
Add a check to avoid the problem.
Fixes: bf4416016c66 ("net/nfp: split out flow item check logic")
Fixes: 18c0ba1d69a8 ("net/nfp: split out flow action check logic")
Cc: chaoyong.he at corigine.com
Signed-off-by: Long Wu <long.wu at corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he at corigine.com>
---
v2: add the 'Fixes' line and 'Reviewed-by' tag.
---
drivers/net/nfp/flower/nfp_flower_flow.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index d127171fdb..24e7047407 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -931,7 +931,7 @@ nfp_flow_item_check_port(struct nfp_item_calculate_param *param)
const struct rte_flow_item_port_id *port_id;
port_id = param->item->spec;
- if (port_id == NULL || port_id->id >= RTE_MAX_ETHPORTS)
+ if (port_id == NULL || rte_eth_dev_is_valid_port(port_id->id) == 0)
return -ERANGE;
return 0;
@@ -1256,7 +1256,7 @@ nfp_flow_action_check_port(struct nfp_action_calculate_param *param)
port_id = action_port_id->id;
}
- if (port_id >= RTE_MAX_ETHPORTS)
+ if (rte_eth_dev_is_valid_port(port_id) == 0)
return -ERANGE;
return 0;
--
2.39.1
More information about the dev
mailing list