net/mlx5e: Warn when destroying mod hdr hash table that is not empty
authorRoi Dayan <roid@nvidia.com>
Thu, 22 Sep 2022 08:03:30 +0000 (11:03 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 18 Jan 2023 18:34:08 +0000 (10:34 -0800)
To avoid memory leaks add a warn when destroying mod hdr hash table
but the hash table is not empty.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/mod_hdr.c

index 17325c5d65160548ee86f2b85ab56921f3e74fb6..cf60f0a3ff233e6bca1a17198650f7e627a48f44 100644 (file)
@@ -47,6 +47,7 @@ void mlx5e_mod_hdr_tbl_init(struct mod_hdr_tbl *tbl)
 
 void mlx5e_mod_hdr_tbl_destroy(struct mod_hdr_tbl *tbl)
 {
+       WARN_ON(!hash_empty(tbl->hlist));
        mutex_destroy(&tbl->lock);
 }