Fix potential core dump when closing ports at exit 15/70215/2
authorXavier Simonart <xavier.simonart@intel.com>
Tue, 26 May 2020 09:20:22 +0000 (11:20 +0200)
committerXavier Simonart <xavier.simonart@intel.com>
Fri, 29 May 2020 21:46:29 +0000 (23:46 +0200)
Change-Id: I45ea9741be1c552d8f13a7de027994c23995df69
Signed-off-by: Xavier Simonart <xavier.simonart@intel.com>
VNFs/DPPD-PROX/prox_port_cfg.c
VNFs/DPPD-PROX/run.c

index a4f3526..2e19d25 100644 (file)
@@ -45,6 +45,7 @@
 #include "stats_irq.h"
 #include "prox_compat.h"
 #include "rte_ethdev.h"
+#include "lconf.h"
 
 struct prox_port_cfg prox_port_cfg[PROX_MAX_PORTS];
 
@@ -857,6 +858,16 @@ void close_ports_atexit(void)
                plog_info("Closing port %u\n", portid);
                rte_eth_dev_close(portid);
        }
+
+       struct lcore_cfg *lconf = NULL;
+       struct task_args *targ;
+       while (core_targ_next(&lconf, &targ, 0) == 0) {
+               if (targ->pool) {
+                       rte_mempool_free(targ->pool);
+                       plog_info("freeing pool %p\n", targ->pool);
+                       targ->pool = NULL;
+               }
+       }
 }
 
 void init_port_addr(void)
index d568dba..c05f0a9 100644 (file)
@@ -277,15 +277,6 @@ void __attribute__((noreturn)) run(uint32_t flags)
                stop_core_all(-1);
        }
 
-       struct lcore_cfg *lconf = NULL;
-       struct task_args *targ;
-       while (core_targ_next(&lconf, &targ, 0) == 0) {
-               if (targ->pool) {
-                       rte_mempool_free(targ->pool);
-                       plog_info("freeing pool %p\n", targ->pool);
-                       targ->pool = NULL;
-               }
-       }
        if (prox_cfg.logbuf) {
                file_print(prox_cfg.logbuf);
        }