From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 70E23A046B for ; Mon, 19 Aug 2019 15:58:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5A86F1BEB0; Mon, 19 Aug 2019 15:58:23 +0200 (CEST) Received: from mta.qwilt.com (mta.qwilt.com [52.9.191.255]) by dpdk.org (Postfix) with ESMTP id DA1741BEAD for ; Mon, 19 Aug 2019 15:58:21 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mta.qwilt.com (Postfix) with ESMTP id 0990C968631; Mon, 19 Aug 2019 13:58:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at qwilt.com Received: from mta.qwilt.com ([127.0.0.1]) by localhost (mta.qwilt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hjSiuB51A--y; Mon, 19 Aug 2019 13:58:20 +0000 (UTC) Received: from rd02.it.qwilt.com.qwilt.com (backup [80.179.204.39]) by mta.qwilt.com (Postfix) with ESMTPSA id ABE6396862D; Mon, 19 Aug 2019 13:58:19 +0000 (UTC) From: Arnon Warshavsky To: dev@dpdk.org, david.marchand@redhat.com, john.mcnamara@intel.com Cc: arnon@qwilt.com Date: Mon, 19 Aug 2019 16:57:44 +0300 Message-Id: <1566223064-19932-1-git-send-email-arnon@qwilt.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1566110854-2669-1-git-send-email-arnon@qwilt.com> References: <1566110854-2669-1-git-send-email-arnon@qwilt.com> Subject: [dpdk-dev] [PATCH v2] eal: unmap undesired address upon config reattach failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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") Signed-off-by: Arnon Warshavsky --- -v2 added fixes messages and applied also to freebsd lib/librte_eal/freebsd/eal/eal.c | 1 + lib/librte_eal/linux/eal/eal.c | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c index d53f0fe..963db76 100644 --- a/lib/librte_eal/freebsd/eal/eal.c +++ b/lib/librte_eal/freebsd/eal/eal.c @@ -341,6 +341,7 @@ enum rte_iova_mode /* 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 946222c..fac69b9 100644 --- a/lib/librte_eal/linux/eal/eal.c +++ b/lib/librte_eal/linux/eal/eal.c @@ -438,6 +438,7 @@ enum rte_iova_mode 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", -- 1.8.3.1