Skip to content

Commit 139ed6c

Browse files
Maor GottliebSaeed Mahameed
authored andcommitted
net/mlx5: Fix steering memory leak
Flow steering priority and namespace are software only objects that didn't have the proper destructors and were not freed during steering cleanup. Fix it by adding destructor functions for these objects. Fixes: bd71b08 ("net/mlx5: Support multiple updates of steering rules in parallel") Signed-off-by: Maor Gottlieb <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 0c1cc8b commit 139ed6c

File tree

1 file changed

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

1 file changed

+14
-2
lines changed

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

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@ static void del_hw_fte(struct fs_node *node);
174174
static void del_sw_flow_table(struct fs_node *node);
175175
static void del_sw_flow_group(struct fs_node *node);
176176
static void del_sw_fte(struct fs_node *node);
177+
static void del_sw_prio(struct fs_node *node);
178+
static void del_sw_ns(struct fs_node *node);
177179
/* Delete rule (destination) is special case that
178180
* requires to lock the FTE for all the deletion process.
179181
*/
@@ -408,6 +410,16 @@ static inline struct mlx5_core_dev *get_dev(struct fs_node *node)
408410
return NULL;
409411
}
410412

413+
static void del_sw_ns(struct fs_node *node)
414+
{
415+
kfree(node);
416+
}
417+
418+
static void del_sw_prio(struct fs_node *node)
419+
{
420+
kfree(node);
421+
}
422+
411423
static void del_hw_flow_table(struct fs_node *node)
412424
{
413425
struct mlx5_flow_table *ft;
@@ -2064,7 +2076,7 @@ static struct fs_prio *fs_create_prio(struct mlx5_flow_namespace *ns,
20642076
return ERR_PTR(-ENOMEM);
20652077

20662078
fs_prio->node.type = FS_TYPE_PRIO;
2067-
tree_init_node(&fs_prio->node, NULL, NULL);
2079+
tree_init_node(&fs_prio->node, NULL, del_sw_prio);
20682080
tree_add_node(&fs_prio->node, &ns->node);
20692081
fs_prio->num_levels = num_levels;
20702082
fs_prio->prio = prio;
@@ -2090,7 +2102,7 @@ static struct mlx5_flow_namespace *fs_create_namespace(struct fs_prio *prio)
20902102
return ERR_PTR(-ENOMEM);
20912103

20922104
fs_init_namespace(ns);
2093-
tree_init_node(&ns->node, NULL, NULL);
2105+
tree_init_node(&ns->node, NULL, del_sw_ns);
20942106
tree_add_node(&ns->node, &prio->node);
20952107
list_add_tail(&ns->node.list, &prio->node.children);
20962108

0 commit comments

Comments
 (0)