From: "Jastrzebski, MichalX K" <michalx.k.jastrzebski@intel.com>
To: "Mrzyglod, DanielX T" <danielx.t.mrzyglod@intel.com>,
"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] af_packet: fix possible memory leak
Date: Fri, 19 Dec 2014 15:47:18 +0000 [thread overview]
Message-ID: <60ABE07DBB3A454EB7FAD707B4BB1582138C1E9A@IRSMSX109.ger.corp.intel.com> (raw)
In-Reply-To: <1419001296-8300-1-git-send-email-danielx.t.mrzyglod@intel.com>
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Daniel Mrzyglod
> Sent: Friday, December 19, 2014 4:02 PM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH] af_packet: fix possible memory leak
>
> In rte_pmd_init_internals, we are mapping memory but not released
> if error occure it could produce memoryleak.
> Add unmmap function to release memory.
>
> Signed-off-by: Daniel Mrzyglod <danielx.t.mrzyglod@intel.com>
> ---
> lib/librte_pmd_af_packet/rte_eth_af_packet.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> index 236749b..93e6b6b 100644
> --- a/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> +++ b/lib/librte_pmd_af_packet/rte_eth_af_packet.c
> @@ -481,6 +481,11 @@ rte_pmd_init_internals(const char *name,
> if (*internals == NULL)
> goto error;
>
> + for (q = 0; q < nb_queues; q++) {
> + (*internals)->rx_queue[q].map = MAP_FAILED;
> + (*internals)->tx_queue[q].map = MAP_FAILED;
> + }
> +
> req = &((*internals)->req);
>
> req->tp_block_size = blocksize;
> @@ -682,6 +687,8 @@ error:
> rte_free(pci_dev);
> if (*internals) {
> for (q = 0; q < nb_queues; q++) {
> + munmap((*internals)->rx_queue[q].map,
> + 2 * req-
> >tp_block_size * req->tp_block_nr);
> if ((*internals)->rx_queue[q].rd)
> rte_free((*internals)->rx_queue[q].rd);
> if ((*internals)->tx_queue[q].rd)
> --
> 2.1.0
Acked-by: Michal Jastrzebski <michalx.k.jastrzebski@intel.com>
next prev parent reply other threads:[~2014-12-19 15:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-19 15:01 Daniel Mrzyglod
2014-12-19 15:47 ` Jastrzebski, MichalX K [this message]
2014-12-19 19:35 ` John W. Linville
2014-12-19 22:34 ` 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=60ABE07DBB3A454EB7FAD707B4BB1582138C1E9A@IRSMSX109.ger.corp.intel.com \
--to=michalx.k.jastrzebski@intel.com \
--cc=danielx.t.mrzyglod@intel.com \
--cc=dev@dpdk.org \
/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).