net/mlx5e: CT: Fix NAT miss rule cleanup on init failure
Subsystems (4)
PATCH 1/1 net/mlx5e: CT: Fix NAT miss rule cleanup on init failure
mlx5_tc_ct_init() creates the CT-NAT miss rule before initializing the conntrack hash tables, workqueue and flow-steering state.
If one of those later initialization steps fails, the error path destroys the CT-NAT table but does not delete the miss rule and flow group created in that table.
Add a dedicated unwind step to delete the CT-NAT miss rule before destroying the CT-NAT table.
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +4 -1
@@ -2349,7 +2349,7 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, &ct_priv->ct_nat_miss_group, &ct_priv->ct_nat_miss_rule);if (err) - goto err_ct_zone_ht; + goto err_ct_nat_miss_rule; ct_priv->post_act = post_act;mutex_init (&ct_priv->control_lock);
@@ -2382,6 +2382,9 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, err_ct_tuples_ht:rhashtable_destroy (&ct_priv->zone_ht); err_ct_zone_ht: +tc_ct_del_ct_table_miss_rule (ct_priv->ct_nat_miss_group, + ct_priv->ct_nat_miss_rule); +err_ct_nat_miss_rule:mlx5_chains_destroy_global_table (chains, ct_priv->ct_nat); err_ct_nat_tbl:mlx5_chains_destroy_global_table (chains, ct_priv->ct);
Signature · 1 line
2.43.0
Quoted 30 lines · Prathamesh Deshpande
mlx5_tc_ct_init()creates the CT-NAT miss rule before initializing the conntrack hash tables, workqueue and flow-steering state.If one of those later initialization steps fails, the error path destroys the CT-NAT table but does not delete the miss rule and flow group created in that table.
Add a dedicated unwind step to delete the CT-NAT miss rule before destroying the CT-NAT table.
Fixes 49d37d05f216 ("net/mlx5: CT: Separate CT and CT-NAT tuple entries")Signed-off-by Prathamesh Deshpande <[email protected]>--- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +1
-1@@ -2349,7 +2349,7 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, &ct_priv->ct_nat_miss_group, &ct_priv->ct_nat_miss_rule);if (err) - goto err_ct_zone_ht; + goto err_ct_nat_miss_rule; ct_priv->post_act = post_act;mutex_init (&ct_priv->control_lock);
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, · line 2390
Quoted 9 lines
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c +3
-0@@ -2382,6 +2382,9 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains, err_ct_tuples_ht:rhashtable_destroy (&ct_priv->zone_ht); err_ct_zone_ht: +tc_ct_del_ct_table_miss_rule (ct_priv->ct_nat_miss_group, + ct_priv->ct_nat_miss_rule); +err_ct_nat_miss_rule:mlx5_chains_destroy_global_table (chains, ct_priv->ct_nat); err_ct_nat_tbl:mlx5_chains_destroy_global_table (chains, ct_priv->ct);
Thanks.