DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@6wind.com>
To: Marcin Kerlin <marcinx.kerlin@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Subject: Re: [dpdk-dev] [PATCH 1/1] lib/librte_eal: fix resource leak
Date: Wed, 20 Apr 2016 11:15:59 +0200	[thread overview]
Message-ID: <CALwxeUv6TV=E7H00JKTr7jwYCyswQKh=OLbBTaj2isvZwBHyuQ@mail.gmail.com> (raw)
In-Reply-To: <1461083251-31140-1-git-send-email-marcinx.kerlin@intel.com>

On Tue, Apr 19, 2016 at 6:27 PM, Marcin Kerlin <marcinx.kerlin@intel.com> wrote:
> Fix issue reported by Coverity.
>
> Coverity ID 13295, 13296, 13303:
> Resource leak: The system resource will not be reclaimed
> and reused, reducing the future availability of the resource.
> In rte_eal_hugepage_attach: Leak of memory or pointers to system
> resources.
>
> Fixes: af75078fece3 ("first public release")
>
> Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
> ---
>  lib/librte_eal/linuxapp/eal/eal_memory.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c
> index 5b9132c..6320aa0 100644
> --- a/lib/librte_eal/linuxapp/eal/eal_memory.c
> +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c
> @@ -1475,13 +1475,17 @@ rte_eal_hugepage_attach(void)
>                                         "and retry running both primary "
>                                         "and secondary processes\n");
>                         }
> +
> +                       if (base_addr != MAP_FAILED)
> +                               munmap((void *)(uintptr_t)base_addr, mcfg->memseg[s].len);
> +

What is the point of this casting ?
Idem for the rest of the patch.


I can't see cleanup for previously mapped segments when mapping one fails.
Do we want this cleanup as well ?

CC Sergio.


-- 
David Marchand

  reply	other threads:[~2016-04-20  9:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 16:27 Marcin Kerlin
2016-04-20  9:15 ` David Marchand [this message]
2016-04-21 11:19   ` Sergio Gonzalez Monroy
2016-04-21 11:49     ` Kerlin, MarcinX
2016-04-22 10:42     ` Panu Matilainen
2016-06-14 15:33 ` [dpdk-dev] [PATCH v2 1/1] eal: fix resource leak of mapped memory Marcin Kerlin
2016-06-15  8:49   ` Sergio Gonzalez Monroy
2016-06-15  9:35     ` Kerlin, MarcinX
2016-06-15 10:05       ` Panu Matilainen
2016-06-15 11:13         ` Kerlin, MarcinX
2016-06-15 10:45   ` [dpdk-dev] [PATCH v3 " Marcin Kerlin
2016-06-15 12:25     ` [dpdk-dev] [PATCH v4 " Marcin Kerlin
2016-06-16 12:57       ` Sergio Gonzalez Monroy
2016-06-16 15:14       ` [dpdk-dev] [PATCH v5 " Marcin Kerlin
2016-06-20  9:30         ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALwxeUv6TV=E7H00JKTr7jwYCyswQKh=OLbBTaj2isvZwBHyuQ@mail.gmail.com' \
    --to=david.marchand@6wind.com \
    --cc=dev@dpdk.org \
    --cc=marcinx.kerlin@intel.com \
    --cc=sergio.gonzalez.monroy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).