Skip to content

Commit

Permalink
net/mlx5e: Fix free peer_flow when refcount is 0
Browse files Browse the repository at this point in the history
It could be neigh update flow took a refcount on peer flow so
sometimes we cannot release peer flow even if parent flow is
being freed now.

Fixes: 5a7e5bc ("net/mlx5e: Extend tc flow struct with reference counter")
Signed-off-by: Roi Dayan <[email protected]>
Reviewed-by: Eli Britstein <[email protected]>
Signed-off-by: Saeed Mahameed <[email protected]>
  • Loading branch information
roidayan authored and Saeed Mahameed committed Dec 5, 2019
1 parent a23dae7 commit eb252c3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,8 +1626,11 @@ static void __mlx5e_tc_del_fdb_peer_flow(struct mlx5e_tc_flow *flow)

flow_flag_clear(flow, DUP);

mlx5e_tc_del_fdb_flow(flow->peer_flow->priv, flow->peer_flow);
kfree(flow->peer_flow);
if (refcount_dec_and_test(&flow->peer_flow->refcnt)) {
mlx5e_tc_del_fdb_flow(flow->peer_flow->priv, flow->peer_flow);
kfree(flow->peer_flow);
}

flow->peer_flow = NULL;
}

Expand Down

0 comments on commit eb252c3

Please sign in to comment.