Message ID | 1465961172-28253-1-git-send-email-mukawa@igel.co.jp (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 72AB4ADBA; Wed, 15 Jun 2016 05:26:46 +0200 (CEST) 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 <dev@dpdk.org>; Wed, 15 Jun 2016 05:26:44 +0200 (CEST) Received: by mail-pa0-f51.google.com with SMTP id b5so2880134pas.3 for <dev@dpdk.org>; Tue, 14 Jun 2016 20:26:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=igel-co-jp.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=MnplZxOl1TYJ/+zlv+PWUFoj8j8wvSA+JFNzVNcR3SI=; b=YGZF8zYnDlHxdx4KGoT1lsIBcpk+vOZ1wvx8O//7FcKEbFH4AWq2H6/yHXxYJ6a0Nv LmzE+FxTIC/eX4NTKqmIePvLghH8BuyuZyQsv3G6yqglC5Yqxh0CdJi8jgWzfvdTQh1w 5wckpwIeyn4LsByMunrwqAiBh0TCV5h9JrvX0/MI0PVUE1wkU/Ue8A2GLHkCqXOCv6eX aFNq5FOxQFt4ptjEP1zFYVen6Si1z5uZmSFOBHRRDHdQvyPvXI4xRJXPRxni5v6B58Ha hTfs96dN49s0UU8OpEfo5c2ixaBqaNzr9h89NUYZGj4v2Ee+BabwQr672N2lfalMUtRs 9glA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MnplZxOl1TYJ/+zlv+PWUFoj8j8wvSA+JFNzVNcR3SI=; b=LbvWt+BsSBAfWPX/bEUyGHAhmgOwr4Y1WY9DKEgiF86NnnUh2KnhX5Q+St4pi93Z7D qOplGccXPWoAY4OixJmqOD0FA3qjd6LDbrBTW2chcxW+s0LTqxKQ3qynIBFkhZc0Lj1W TjBo7GNfEZPyvEtm+4glscz/GVrO1OKsB+ZB2QkNE2X2B1B4ow53he1QblFlHmeIbi+q nTmZVQNDQqVQm3HjpMKc5d7iiEdhvdx5WJ2o8+2m2wAzpZkGzxBAlij+6AQ2DdFhMnAQ S348YfgGBZd7GMJxHwxIpJfZwEnz3lMJArYRA15A5x4g/EydCl6nQe3fPVq1JC7NVtWS bagg== X-Gm-Message-State: ALyK8tINrDArPAcKl+sffQ2XODTqakq9YvcoZDwuQ/gORoVgzw2hlIoABgrMo5jlIakjDQ== X-Received: by 10.67.22.129 with SMTP id hs1mr1229874pad.105.1465961203569; Tue, 14 Jun 2016 20:26:43 -0700 (PDT) Received: from localhost.localdomain (napt.igel.co.jp. [219.106.231.132]) by smtp.gmail.com with ESMTPSA id vb6sm48593270pac.16.2016.06.14.20.26.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 14 Jun 2016 20:26:43 -0700 (PDT) From: Tetsuya Mukawa <mukawa@igel.co.jp> To: dev@dpdk.org Cc: david.marchand@6wind.com, john.mcnamara@intel.com, michalx.k.jastrzebski@intel.com, Tetsuya Mukawa <mukawa@igel.co.jp> Date: Wed, 15 Jun 2016 12:26:12 +0900 Message-Id: <1465961172-28253-1-git-send-email-mukawa@igel.co.jp> X-Mailer: git-send-email 2.7.4 Subject: [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 <dev.dpdk.org> List-Unsubscribe: <http://dpdk.org/ml/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://dpdk.org/ml/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <http://dpdk.org/ml/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Commit Message
Tetsuya Mukawa
June 15, 2016, 3:26 a.m. UTC
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 <mukawa@igel.co.jp>
---
lib/librte_eal/common/eal_common_pci_uio.c | 3 +++
1 file changed, 3 insertions(+)
Comments
Hello Tetsuya, On Wed, Jun 15, 2016 at 5:26 AM, Tetsuya Mukawa <mukawa@igel.co.jp> 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 <mukawa@igel.co.jp> 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 ?
On 2016/06/15 23:45, David Marchand wrote: > Hello Tetsuya, > > On Wed, Jun 15, 2016 at 5:26 AM, Tetsuya Mukawa <mukawa@igel.co.jp> 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 <mukawa@igel.co.jp> > > The title should not contain the function name. Hi David, Thanks, I will change the title of all patches. > > >> --- >> 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 ? I will unmap all addresses mapped before. Thanks, Tetsuya
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; } }