@@ -2127,12 +2127,21 @@ mlx5_tc_ct_init(struct mlx5e_priv *priv, struct mlx5_fs_chains *chains,
ct_priv->post_act = post_act;
mutex_init(&ct_priv->control_lock);
- rhashtable_init(&ct_priv->zone_ht, &zone_params);
- rhashtable_init(&ct_priv->ct_tuples_ht, &tuples_ht_params);
- rhashtable_init(&ct_priv->ct_tuples_nat_ht, &tuples_nat_ht_params);
+ if (rhashtable_init(&ct_priv->zone_ht, &zone_params))
+ goto err_ct_zone_ht;
+ if (rhashtable_init(&ct_priv->ct_tuples_ht, &tuples_ht_params))
+ goto err_ct_tuples_ht;
+ if (rhashtable_init(&ct_priv->ct_tuples_nat_ht, &tuples_nat_ht_params))
+ goto err_ct_tuples_nat_ht;
return ct_priv;
+err_ct_tuples_nat_ht:
+ rhashtable_destroy(&ct_priv->ct_tuples_nat_ht);
+err_ct_tuples_ht:
+ rhashtable_destroy(&ct_priv->ct_tuples_ht);
+err_ct_zone_ht:
+ rhashtable_destroy(&ct_priv->zone_ht);
err_ct_nat_tbl:
mlx5_chains_destroy_global_table(chains, ct_priv->ct);
err_ct_tbl:
@@ -610,7 +610,9 @@ int ila_xlat_init_net(struct net *net)
if (err)
return err;
- rhashtable_init(&ilan->xlat.rhash_table, &rht_params);
+ err = rhashtable_init(&ilan->xlat.rhash_table, &rht_params);
+ if (err)
+ return err;
return 0;
}
@@ -403,9 +403,13 @@ EXPORT_SYMBOL(seg6_hmac_init);
int __net_init seg6_hmac_net_init(struct net *net)
{
+ int err;
+
struct seg6_pernet_data *sdata = seg6_pernet(net);
- rhashtable_init(&sdata->hmac_infos, &rht_params);
+ err = rhashtable_init(&sdata->hmac_infos, &rht_params);
+ if (err)
+ return err;
return 0;
}
@@ -60,7 +60,8 @@ static struct mesh_table *mesh_table_alloc(void)
atomic_set(&newtbl->entries, 0);
spin_lock_init(&newtbl->gates_lock);
spin_lock_init(&newtbl->walk_lock);
- rhashtable_init(&newtbl->rhead, &mesh_rht_params);
+ if (rhashtable_init(&newtbl->rhead, &mesh_rht_params))
+ return NULL;
return newtbl;
}
Handling errors of rhashtable_init. When rhashtable_init fails, it returns -EINVAL. Signed-off-by: MichelleJin <shjy180909@gmail.com> --- .../net/ethernet/mellanox/mlx5/core/en/tc_ct.c | 15 ++++++++++++--- net/ipv6/ila/ila_xlat.c | 4 +++- net/ipv6/seg6_hmac.c | 6 +++++- net/mac80211/mesh_pathtbl.c | 3 ++- 4 files changed, 22 insertions(+), 6 deletions(-)