From db6d49db1b50825fc1d5efde0d113fea05ab412a Mon Sep 17 00:00:00 2001 From: Alaa Hleihel Date: Mon, 1 Jun 2020 15:40:38 -0400 Subject: [PATCH 285/312] [netdrv] net/mlx5: Fix cleaning unmanaged flow tables Message-id: <20200601154102.25980-16-ahleihel@redhat.com> Patchwork-id: 315720 Patchwork-instance: patchwork O-Subject: [RHEL8.3 BZ 1842258 15/39] net/mlx5: Fix cleaning unmanaged flow tables Bugzilla: 1842258 1840408 RH-Acked-by: Honggang Li RH-Acked-by: Kamal Heib RH-Acked-by: Marcelo Leitner RH-Acked-by: Jarod Wilson Bugzilla: http://bugzilla.redhat.com/1842258 Bugzilla: http://bugzilla.redhat.com/1840408 Upstream: v5.7-rc7 commit aee37f3d940ca732df71c3df49347bccaafc0b24 Author: Roi Dayan Date: Mon May 11 16:32:09 2020 +0300 net/mlx5: Fix cleaning unmanaged flow tables Unmanaged flow tables doesn't have a parent and tree_put_node() assume there is always a parent if cleaning is needed. fix that. Fixes: 5281a0c90919 ("net/mlx5: fs_core: Introduce unmanaged flow tables") Signed-off-by: Roi Dayan Reviewed-by: Mark Bloch Reviewed-by: Paul Blakey Signed-off-by: Saeed Mahameed Signed-off-by: Alaa Hleihel Signed-off-by: Frantisek Hrbata --- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c index f44e366ecfa8..6927d9a1c910 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/fs_core.c @@ -323,14 +323,13 @@ static void tree_put_node(struct fs_node *node, bool locked) if (node->del_hw_func) node->del_hw_func(node); if (parent_node) { - /* Only root namespace doesn't have parent and we just - * need to free its node. - */ down_write_ref_node(parent_node, locked); list_del_init(&node->list); if (node->del_sw_func) node->del_sw_func(node); up_write_ref_node(parent_node, locked); + } else if (node->del_sw_func) { + node->del_sw_func(node); } else { kfree(node); } @@ -447,8 +446,10 @@ static void del_sw_flow_table(struct fs_node *node) fs_get_obj(ft, node); rhltable_destroy(&ft->fgs_hash); - fs_get_obj(prio, ft->node.parent); - prio->num_ft--; + if (ft->node.parent) { + fs_get_obj(prio, ft->node.parent); + prio->num_ft--; + } kfree(ft); } -- 2.13.6