* [dpdk-dev] [PATCH] mempool: fix stack handler dequeue
@ 2017-01-23 17:11 Olivier Matz
2017-01-29 22:37 ` Thomas Monjalon
0 siblings, 1 reply; 2+ messages in thread
From: Olivier Matz @ 2017-01-23 17:11 UTC (permalink / raw)
To: dev; +Cc: david.hunt, stable
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 <olivier.matz@6wind.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [dpdk-dev] [PATCH] mempool: fix stack handler dequeue
2017-01-23 17:11 [dpdk-dev] [PATCH] mempool: fix stack handler dequeue Olivier Matz
@ 2017-01-29 22:37 ` Thomas Monjalon
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2017-01-29 22:37 UTC (permalink / raw)
To: Olivier Matz; +Cc: dev, david.hunt, stable
2017-01-23 18:11, Olivier Matz:
> 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 <olivier.matz@6wind.com>
Applied, thanks
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-01-29 22:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-23 17:11 [dpdk-dev] [PATCH] mempool: fix stack handler dequeue Olivier Matz
2017-01-29 22:37 ` Thomas Monjalon
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).