net/enic: fix flow initialization error handling
authorJohn Daley <johndale@cisco.com>
Thu, 8 Apr 2021 23:06:31 +0000 (16:06 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 9 Apr 2021 08:54:57 +0000 (10:54 +0200)
Fix a rare case in rte_flow initialization where the action hash table
is not freed if allocating a NIC match table fails.

Fixes: ea7768b5bba8 ("net/enic: add flow implementation based on Flow Manager API")
Cc: stable@dpdk.org
Signed-off-by: John Daley <johndale@cisco.com>
Reviewed-by: Hyong Youb Kim <hyonkim@cisco.com>
drivers/net/enic/enic_fm_flow.c

index 21d9b1c..cd364ee 100644 (file)
@@ -2890,7 +2890,7 @@ enic_fm_init(struct enic *enic)
        rc = enic_fm_init_actions(fm);
        if (rc) {
                ENICPMD_LOG(ERR, "cannot create action hash, error:%d", rc);
-               goto error_tables;
+               goto error_counters;
        }
        /*
         * One default exact match table for each direction. We hold onto
@@ -2899,7 +2899,7 @@ enic_fm_init(struct enic *enic)
        rc = enic_fet_alloc(fm, 1, NULL, 128, &fm->default_ig_fet);
        if (rc) {
                ENICPMD_LOG(ERR, "cannot alloc default IG exact match table");
-               goto error_counters;
+               goto error_actions;
        }
        fm->default_ig_fet->ref = 1;
        rc = enic_fet_alloc(fm, 0, NULL, 128, &fm->default_eg_fet);
@@ -2914,6 +2914,8 @@ enic_fm_init(struct enic *enic)
 
 error_ig_fet:
        enic_fet_free(fm, fm->default_ig_fet);
+error_actions:
+       rte_hash_free(fm->action_hash);
 error_counters:
        enic_fm_free_all_counters(fm);
 error_tables: