The location of indexed rules is determined by the index, not the item hash. A matcher test is added to prevent access to non-existent items. This avoids unnecessary processing and potential segmentation faults.
Fixes: 405242c ("net/mlx5/hws: add rule object") Signed-off-by: Itamar Gozlan <igoz...@nvidia.com> Acked-by: Matan Azrad <ma...@nvidia.com> --- drivers/net/mlx5/hws/mlx5dr_rule.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/mlx5/hws/mlx5dr_rule.c b/drivers/net/mlx5/hws/mlx5dr_rule.c index fa19303b91..e39137a6ee 100644 --- a/drivers/net/mlx5/hws/mlx5dr_rule.c +++ b/drivers/net/mlx5/hws/mlx5dr_rule.c @@ -23,6 +23,9 @@ static void mlx5dr_rule_skip(struct mlx5dr_matcher *matcher, *skip_rx = false; *skip_tx = false; + if (unlikely(mlx5dr_matcher_is_insert_by_idx(matcher))) + return; + if (mt->item_flags & MLX5_FLOW_ITEM_REPRESENTED_PORT) { v = items[mt->vport_item_id].spec; vport = flow_hw_conv_port_id(v->port_id); -- 2.39.3