]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5: Fix cleaning unmanaged flow tables
authorRoi Dayan <roid@mellanox.com>
Mon, 11 May 2020 13:32:09 +0000 (16:32 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Sat, 23 May 2020 00:28:48 +0000 (17:28 -0700)
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: 181a26e6d20d ("net/mlx5: fs_core: Introduce unmanaged flow tables")
Signed-off-by: Roi Dayan <roid@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Reviewed-by: Paul Blakey <paulb@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c

index d5defe09339a8a4e406027062b0e64f855f4acd2..8f62bfcf57af3062cd78cdada05615005733e539 100644 (file)
@@ -344,14 +344,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);
                }
@@ -468,8 +467,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);
 }