From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 1D3EF2A5B; Mon, 23 Jan 2017 18:11:39 +0100 (CET) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 8666C24ACF; Mon, 23 Jan 2017 18:11:35 +0100 (CET) From: Olivier Matz To: dev@dpdk.org Cc: david.hunt@dpdk.org, stable@dpdk.org Date: Mon, 23 Jan 2017 18:11:03 +0100 Message-Id: <1485191463-22992-1-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.1 Subject: [dpdk-dev] [PATCH] mempool: fix stack handler dequeue X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 Jan 2017 17:11:40 -0000 The return value of the stack handler is wrong: it should be 0 on success, not the number of objects dequeued. This could lead to memory leaks depending on how the caller checks the return value (ret < 0 or ret != 0). This was also breaking autotests with debug enabled, because the debug cookies are only updated when the function returns 0, so the cookies were not updated, leading to an abort(). Fixes: 295a530b0844 ("mempool: add stack mempool handler") CC: stable@dpdk.org Signed-off-by: Olivier Matz --- lib/librte_mempool/rte_mempool_stack.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool_stack.c b/lib/librte_mempool/rte_mempool_stack.c index 5fd8af2..817f77e 100644 --- a/lib/librte_mempool/rte_mempool_stack.c +++ b/lib/librte_mempool/rte_mempool_stack.c @@ -118,7 +118,7 @@ stack_dequeue(struct rte_mempool *mp, void **obj_table, s->len -= n; rte_spinlock_unlock(&s->sl); - return n; + return 0; } static unsigned -- 2.8.1