[dpdk-stable] patch 'mempool: fix leak when no objects are populated' has been queued to LTS release 17.11.3

Yuanhan Liu yliu at fridaylinux.org
Sun May 6 08:36:22 CEST 2018


Hi,

FYI, your patch has been queued to LTS release 17.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/09/18. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From 383a388cb2287fff950d68a95252e985476168bf Mon Sep 17 00:00:00 2001
From: Andrew Rybchenko <arybchenko at solarflare.com>
Date: Mon, 16 Apr 2018 14:24:30 +0100
Subject: [PATCH] mempool: fix leak when no objects are populated

[ upstream commit 25e6755056eaba45921b898b9986af68277ac6ac ]

Fixes: 84121f197187 ("mempool: store memory chunks in a list")

Suggested-by: Olivier Matz <olivier.matz at 6wind.com>
Signed-off-by: Andrew Rybchenko <arybchenko at solarflare.com>
Acked-by: Olivier Matz <olivier.matz at 6wind.com>
---
 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 5bd74eac8..5bb286a41 100644
--- a/lib/librte_mempool/rte_mempool.c
+++ b/lib/librte_mempool/rte_mempool.c
@@ -437,12 +437,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.11.0



More information about the stable mailing list