patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Andrew Rybchenko <arybchenko@solarflare.com>
To: <dev@dpdk.org>
Cc: Olivier MATZ <olivier.matz@6wind.com>, <stable@dpdk.org>
Subject: [dpdk-stable] [PATCH v3 01/11] mempool: fix memhdr leak when no objects are populated
Date: Mon, 26 Mar 2018 17:09:41 +0100	[thread overview]
Message-ID: <1522080591-24705-2-git-send-email-arybchenko@solarflare.com> (raw)
In-Reply-To: <1522080591-24705-1-git-send-email-arybchenko@solarflare.com>

Fixes: 84121f197187 ("mempool: store memory chunks in a list")
Cc: stable@dpdk.org

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
v2 -> v3:
 - none

v1 -> v2:
 - added in v2 as discussed in [1]

[1] https://dpdk.org/ml/archives/dev/2018-March/093329.html

 lib/librte_mempool/rte_mempool.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c
index 54f7f4b..80bf941 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -408,12 +408,18 @@ rte_mempool_populate_iova(struct rte_mempool *mp, char *vaddr,
 	}
 
 	/* not enough room to store one object */
-	if (i == 0)
-		return -EINVAL;
+	if (i == 0) {
+		ret = -EINVAL;
+		goto fail;
+	}
 
 	STAILQ_INSERT_TAIL(&mp->mem_list, memhdr, next);
 	mp->nb_mem_chunks++;
 	return i;
+
+fail:
+	rte_free(memhdr);
+	return ret;
 }
 
 int
-- 
2.7.4

  parent reply	other threads:[~2018-03-26 16:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1511539591-20966-1-git-send-email-arybchenko@solarflare.com>
     [not found] ` <1516713372-10572-1-git-send-email-arybchenko@solarflare.com>
2018-01-23 13:15   ` [dpdk-stable] [RFC v2 01/17] mempool: fix phys contig check if populate default skipped Andrew Rybchenko
2018-01-31 16:45     ` Olivier Matz
2018-02-01  5:05       ` santosh
2018-02-01  6:54         ` Andrew Rybchenko
2018-02-01  9:09           ` santosh
2018-02-01  9:18             ` [dpdk-stable] [dpdk-dev] " Andrew Rybchenko
2018-02-01  9:30               ` santosh
2018-02-01 10:00                 ` Andrew Rybchenko
2018-02-01 10:14                   ` Olivier Matz
2018-02-01 10:33                     ` santosh
2018-02-01 14:02                       ` Andrew Rybchenko
2018-02-01 10:17                   ` santosh
2018-02-01 14:02     ` [dpdk-stable] [PATCH] " Andrew Rybchenko
2018-02-05 23:53       ` Thomas Monjalon
     [not found]   ` <1521994855-8808-1-git-send-email-arybchenko@solarflare.com>
2018-03-25 16:20     ` [dpdk-stable] [PATCH v2 01/11] mempool: fix memhdr leak when no objects are populated Andrew Rybchenko
     [not found]   ` <1522080591-24705-1-git-send-email-arybchenko@solarflare.com>
2018-03-26 16:09     ` Andrew Rybchenko [this message]
2018-04-06 15:50       ` [dpdk-stable] [PATCH v3 " Olivier Matz
     [not found] ` <1523885080-17168-1-git-send-email-arybchenko@solarflare.com>
2018-04-16 13:24   ` [dpdk-stable] [PATCH v4 " Andrew Rybchenko

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=1522080591-24705-2-git-send-email-arybchenko@solarflare.com \
    --to=arybchenko@solarflare.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=stable@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).