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 DC1C4A046B for ; Mon, 19 Aug 2019 17:29:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1C7051BE99; Mon, 19 Aug 2019 17:29:55 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id AE4F01BE94 for ; Mon, 19 Aug 2019 17:29:52 +0200 (CEST) Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F33507BDB0 for ; Mon, 19 Aug 2019 15:29:51 +0000 (UTC) Received: by mail-qt1-f200.google.com with SMTP id z15so4075826qtq.6 for ; Mon, 19 Aug 2019 08:29:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=2SxLAIT0D5S/07j0epjnx8OcQfzj2o+0ulZv8+XB6p4=; b=s9k8vpVuODKtgAqKG+j5ovdICmm4v43Jf/voDsS2bL/glx3Qc7TG3zcAyVnrrKYXxN xuMLc1N48Trrpnqnd47ElTVjJp0owaZ4vmI91Pc5m7gFV5ea3Jk9kqrR8df1blGi2c0i 25jyjW+nouTd0ukfeAXVGtb3iywsuwzgGtKETaoHS+RK9MULEOnEE0OI1UFsFoaUT0ya zVKUzfEOx3pM5HrhyUy1w+6WK2yl4jzp6gYPd0TW51mQSOLh0MHGA43t6FWRTq31qhni SisXXfQJEyIj7be6nT11hZpfZf4Z+W8qr/Vq3kRnqRHfvQvo+vrBLH2vZ1euglVBftWK cIOw== X-Gm-Message-State: APjAAAXURRab8eM+znbiTf7aMJR6KNSjASMwk0iQ3V9T1z157XWLEUhV QVwAW2NJdE3JZqAo4T6g8XNJodAa4xCy5hBL0JdbIHO0xqFdDN3c9aISn0iJv94RdRcH5FqiwRE M5c6hE2GpKLDY8U6XXco= X-Received: by 2002:ad4:420c:: with SMTP id k12mr10845143qvp.94.1566228590944; Mon, 19 Aug 2019 08:29:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxd+84FZ2CBfHRjtb8MoYMGrE37CyOQ8ZDn1cdof1pa2sf8XfkKleeZHDfDySfGSQY9JARqIouaNRtvaFBO0TU= X-Received: by 2002:a02:ad15:: with SMTP id s21mr27902040jan.47.1566228589537; Mon, 19 Aug 2019 08:29:49 -0700 (PDT) MIME-Version: 1.0 References: <1566110854-2669-1-git-send-email-arnon@qwilt.com> <1566223064-19932-1-git-send-email-arnon@qwilt.com> In-Reply-To: <1566223064-19932-1-git-send-email-arnon@qwilt.com> From: David Marchand Date: Mon, 19 Aug 2019 17:29:38 +0200 Message-ID: To: Arnon Warshavsky Cc: dev , "Mcnamara, John" Content-Type: text/plain; charset="UTF-8" Subject: Re: [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" On Mon, Aug 19, 2019 at 3:58 PM Arnon Warshavsky wrote: > > 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 > Thanks Arnon. Reviewed-by: David Marchand -- David Marchand