From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tetsuya Mukawa Subject: [PATCH] eal: Fix resource leak of pci_uio_map_secondary() Date: Wed, 15 Jun 2016 12:26:12 +0900 Message-ID: <1465961172-28253-1-git-send-email-mukawa@igel.co.jp> Cc: david.marchand@6wind.com, john.mcnamara@intel.com, michalx.k.jastrzebski@intel.com, Tetsuya Mukawa To: dev@dpdk.org Return-path: Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by dpdk.org (Postfix) with ESMTP id 5BC59ADB7 for ; Wed, 15 Jun 2016 05:26:44 +0200 (CEST) Received: by mail-pa0-f51.google.com with SMTP id b5so2880134pas.3 for ; Tue, 14 Jun 2016 20:26:44 -0700 (PDT) List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" If pci_map_resource() succeeds but mapped address is different from an address primary process mapped, this should be error. Then the address secondary process mapped should be freed. Signed-off-by: Tetsuya Mukawa --- lib/librte_eal/common/eal_common_pci_uio.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/librte_eal/common/eal_common_pci_uio.c b/lib/librte_eal/common/eal_common_pci_uio.c index f062e81..e718643 100644 --- a/lib/librte_eal/common/eal_common_pci_uio.c +++ b/lib/librte_eal/common/eal_common_pci_uio.c @@ -85,6 +85,9 @@ pci_uio_map_secondary(struct rte_pci_device *dev) "Cannot mmap device resource file %s to address: %p\n", uio_res->maps[i].path, uio_res->maps[i].addr); + if (mapaddr != MAP_FAILED) + pci_unmap_resource(mapaddr, + (size_t)uio_res->maps[i].size); return -1; } } -- 2.7.4