From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f47.google.com (mail-lf0-f47.google.com [209.85.215.47]) by dpdk.org (Postfix) with ESMTP id 39D92C6FE for ; Wed, 15 Jun 2016 16:45:45 +0200 (CEST) Received: by mail-lf0-f47.google.com with SMTP id j7so15444445lfg.1 for ; Wed, 15 Jun 2016 07:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=wJtNcEBh2IqL/4Lf9CKAjYoP4HLMB4YbGQsV5q65UUY=; b=oyjwZa6A/uW2ahCxIu1dLMfigOX1peIBiOzSz6qOcgY8l9oFZdqI015CuBArQb/5wj eymiluGjbKCs/UAL2vZ4Mn/Y3NFAakf7RgV7RZmOwQ3OO8HXqjJX3vYeCg3cW3tx6hGi dTam8ppLkqT8c9oPskx7+dqaeA41CoZ4TsZVbZZNzYA08K+yCxc3Kwb7VHNJ0uiLUN/W SLE9lg1uiJSlwSvVL/6pMoOK/yvnz+PCroHqzPWNiykO+TvpFfe0B+I1jt//MGwfVOze gQpnXwXioP30UWIn+zYEDCZ2R4cF95O8gq0737J9dnFHLxqGnGiPPd17S09kKYIEemLC cTTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=wJtNcEBh2IqL/4Lf9CKAjYoP4HLMB4YbGQsV5q65UUY=; b=FiB1ShajV8An/zIlkp49OuALmFkE7SvDgLV2MG57yL7uB4AcuLgG8Z0k7fQpXtiG36 h1nA5X99wWElMJkAaY7cf+Tn5+cB9mS+TDXM+OtDoHbCVnmblAVnbG31J9g+pCchvN8k qSvMiy3i2+COylGLaHwTLLvOqlz8K1/RC52lJZPFf1MhzMnfeCAHPsOTP9y4Rjt4DFOR omiV0AO5coge9PAi1X3tM5SGCFywOzijg7EFoc/Ew/DTyn1m4vqNUvfst4IXgPTTx2LW 6oh0BbL3+r4ocXVGe7goSFN89ZCGoi7YGsKCeufDHDBHdRf/1oJEf7FrZuv89NpYjqbX sg0g== X-Gm-Message-State: ALyK8tLsKzCc1343oSDj0GJ4AgPGFKP4sMGCf2ENLW4isakSdJ4ndTJt64GcdIAVJ9H3kgovzPyyPKpVYC8sNKZK X-Received: by 10.28.47.71 with SMTP id v68mr10738664wmv.49.1466001944813; Wed, 15 Jun 2016 07:45:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.16.13 with HTTP; Wed, 15 Jun 2016 07:45:25 -0700 (PDT) In-Reply-To: <1465961172-28253-1-git-send-email-mukawa@igel.co.jp> References: <1465961172-28253-1-git-send-email-mukawa@igel.co.jp> From: David Marchand Date: Wed, 15 Jun 2016 16:45:25 +0200 Message-ID: To: Tetsuya Mukawa Cc: "dev@dpdk.org" , "Mcnamara, John" , michalx.k.jastrzebski@intel.com Content-Type: text/plain; charset=UTF-8 Subject: Re: [dpdk-dev] [PATCH] eal: Fix resource leak of pci_uio_map_secondary() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jun 2016 14:45:45 -0000 Hello Tetsuya, On Wed, Jun 15, 2016 at 5:26 AM, Tetsuya Mukawa wrote: > 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 The title should not contain the function name. > --- > 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; > } > } What of the previous mappings that might have succeeded earlier in this loop ? -- David Marchand