Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2951b2e

Browse files
Chris MiSaeed Mahameed
authored andcommitted
net/mlx5e: Always clear dest encap in neigh-update-del
The cited commit introduced a bug for multiple encapsulations flow. If one dest encap becomes invalid, the flow is set slow path flag. But when other dests encap become invalid, they are not cleared due to slow path flag of the flow. When neigh-update-add is running, it will use invalid encap. Fix it by checking slow path flag after clearing dest encap. Fixes: 9a5f9cc ("net/mlx5e: Fix possible use-after-free deleting fdb rule") Signed-off-by: Chris Mi <[email protected]> Reviewed-by: Roi Dayan <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 849190e commit 2951b2e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun_encap.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv,
222222
int err;
223223

224224
list_for_each_entry(flow, flow_list, tmp_list) {
225-
if (!mlx5e_is_offloaded_flow(flow) || flow_flag_test(flow, SLOW))
225+
if (!mlx5e_is_offloaded_flow(flow))
226226
continue;
227227

228228
attr = mlx5e_tc_get_encap_attr(flow);
@@ -231,6 +231,13 @@ void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv,
231231
esw_attr->dests[flow->tmp_entry_index].flags &= ~MLX5_ESW_DEST_ENCAP_VALID;
232232
esw_attr->dests[flow->tmp_entry_index].pkt_reformat = NULL;
233233

234+
/* Clear pkt_reformat before checking slow path flag. Because
235+
* in next iteration, the same flow is already set slow path
236+
* flag, but still need to clear the pkt_reformat.
237+
*/
238+
if (flow_flag_test(flow, SLOW))
239+
continue;
240+
234241
/* update from encap rule to slow path rule */
235242
spec = &flow->attr->parse_attr->spec;
236243
rule = mlx5e_tc_offload_to_slow_path(esw, flow, spec);

0 commit comments

Comments
 (0)