In case of EAL initialization failure rte_eal_memory_detach() may be
called before mapping memory configuration, which in this case points
to the static structure. Attempt to unmap it yields error:
EAL: Could not unmap shared memory config: Invalid argument
Skip unmapping memory configuration if it's not yet shared.
Fixes:
dfbc61a2f9a6 ("mem: detach memsegs on cleanup")
Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
* config - we can't zero it out because it might still be referenced
* by other processes.
*/
- if (internal_conf->no_shconf == 0) {
+ if (internal_conf->no_shconf == 0 && mcfg->mem_cfg_addr != 0) {
if (rte_mem_unmap(mcfg, RTE_ALIGN(sizeof(*mcfg), page_sz)) != 0)
RTE_LOG(ERR, EAL, "Could not unmap shared memory config: %s\n",
rte_strerror(rte_errno));