summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnon Warshavsky <arnon@qwilt.com>2019-08-19 16:57:44 +0300
committerDavid Marchand <david.marchand@redhat.com>2019-10-15 20:37:11 +0200
commit75dbb45f28af31f49617d93e0195daa76df1724c (patch)
treec7b546fe30e3c7f7b65a2900f00314b9ca39fcc7
parent773a860aef951727ea0c5af0f83e15fb0e24e03d (diff)
downloaddpdk-next-eventdev-75dbb45f28af31f49617d93e0195daa76df1724c.zip
dpdk-next-eventdev-75dbb45f28af31f49617d93e0195daa76df1724c.tar.gz
dpdk-next-eventdev-75dbb45f28af31f49617d93e0195daa76df1724c.tar.xz
eal: fix mapping leak in secondary process
Have rte_eal_config_reattach clean up the mapped address which is a valid address but not the one intended. Coverity issue: 343439 Fixes: 4e8854ae89fa ("eal: do not panic on shared memory init") Fixes: b149a7064261 ("eal/freebsd: add config reattach in secondary process") Cc: stable@dpdk.org Signed-off-by: Arnon Warshavsky <arnon@qwilt.com> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com> Reviewed-by: David Marchand <david.marchand@redhat.com>
-rw-r--r--lib/librte_eal/freebsd/eal/eal.c1
-rw-r--r--lib/librte_eal/linux/eal/eal.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c
index 270ce54..f86e9aa 100644
--- a/lib/librte_eal/freebsd/eal/eal.c
+++ b/lib/librte_eal/freebsd/eal/eal.c
@@ -340,6 +340,7 @@ rte_eal_config_reattach(void)
/* errno is stale, don't use */
RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]\n",
rte_mem_cfg_addr, mem_config);
+ munmap(mem_config, sizeof(struct rte_mem_config));
return -1;
}
diff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c
index c6ad231..f397206 100644
--- a/lib/librte_eal/linux/eal/eal.c
+++ b/lib/librte_eal/linux/eal/eal.c
@@ -437,6 +437,7 @@ rte_eal_config_reattach(void)
RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config at [%p], got [%p]"
" - please use '--base-virtaddr' option\n",
rte_mem_cfg_addr, mem_config);
+ munmap(mem_config, sizeof(struct rte_mem_config));
return -1;
}
RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n",