Skip to content

Commit

Permalink
net/mlx5: fix Direct Verbs flow descriptor allocation
Browse files Browse the repository at this point in the history
[ upstream commit 3ab5a3a ]

Initialize flow descriptor tunnel member during flow creation.
Prevent access to stale data and pointers when flow descriptor is
reallocated after release.
Fix flow index validation.

Fixes: e7bfa35 ("net/mlx5: separate the flow handle resource")
Fixes: 8bb81f2 ("net/mlx5: use thread specific flow workspace")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
  • Loading branch information
getelson-at-mellanox authored and bluca committed Feb 2, 2021
1 parent 482a496 commit ac07d94
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/net/mlx5/mlx5_flow_dv.c
Original file line number Diff line number Diff line change
Expand Up @@ -6232,8 +6232,9 @@ flow_dv_prepare(struct rte_eth_dev *dev,
"not enough memory to create flow handle");
return NULL;
}
MLX5_ASSERT(wks->flow_idx + 1 < RTE_DIM(wks->flows));
MLX5_ASSERT(wks->flow_idx < RTE_DIM(wks->flows));
dev_flow = &wks->flows[wks->flow_idx++];
memset(dev_flow, 0, sizeof(*dev_flow));
dev_flow->handle = dev_handle;
dev_flow->handle_idx = handle_idx;
/*
Expand All @@ -6245,12 +6246,6 @@ flow_dv_prepare(struct rte_eth_dev *dev,
*/
dev_flow->dv.value.size = MLX5_ST_SZ_BYTES(fte_match_param) -
MLX5_ST_SZ_BYTES(fte_match_set_misc4);
/*
* The matching value needs to be cleared to 0 before using. In the
* past, it will be automatically cleared when using rte_*alloc
* API. The time consumption will be almost the same as before.
*/
memset(dev_flow->dv.value.buf, 0, MLX5_ST_SZ_BYTES(fte_match_param));
dev_flow->ingress = attr->ingress;
dev_flow->dv.transfer = attr->transfer;
return dev_flow;
Expand Down

0 comments on commit ac07d94

Please sign in to comment.