net/bnxt: fix null pointer dereference
authorKishore Padmanabha <kishore.padmanabha@broadcom.com>
Fri, 17 Jul 2020 14:14:47 +0000 (19:44 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Jul 2020 11:54:54 +0000 (13:54 +0200)
Avoid dereferencing a null pointer.

Fixes: 313ac35ac701 ("net/bnxt: support ULP session manager init")
Cc: stable@dpdk.org
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
drivers/net/bnxt/tf_ulp/ulp_mark_mgr.c

index b2c8c34..4df850f 100644 (file)
@@ -120,9 +120,11 @@ gfid_not_required:
        return 0;
 
 mem_error:
-       rte_free(mark_tbl->gfid_tbl);
-       rte_free(mark_tbl->lfid_tbl);
-       rte_free(mark_tbl);
+       if (mark_tbl) {
+               rte_free(mark_tbl->gfid_tbl);
+               rte_free(mark_tbl->lfid_tbl);
+               rte_free(mark_tbl);
+       }
        BNXT_TF_DBG(DEBUG, "Failed to allocate memory for mark mgr\n");
        return -ENOMEM;
 }