Skip to content

Commit eb252c3

Browse files
roidayanSaeed Mahameed
authored andcommitted
net/mlx5e: Fix free peer_flow when refcount is 0
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]>
1 parent a23dae7 commit eb252c3

File tree

1 file changed

+5
-2
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+5
-2
lines changed

drivers/net/ethernet/mellanox/mlx5/core/en_tc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,8 +1626,11 @@ static void __mlx5e_tc_del_fdb_peer_flow(struct mlx5e_tc_flow *flow)
16261626

16271627
flow_flag_clear(flow, DUP);
16281628

1629-
mlx5e_tc_del_fdb_flow(flow->peer_flow->priv, flow->peer_flow);
1630-
kfree(flow->peer_flow);
1629+
if (refcount_dec_and_test(&flow->peer_flow->refcnt)) {
1630+
mlx5e_tc_del_fdb_flow(flow->peer_flow->priv, flow->peer_flow);
1631+
kfree(flow->peer_flow);
1632+
}
1633+
16311634
flow->peer_flow = NULL;
16321635
}
16331636

0 commit comments

Comments
 (0)