[dpdk-dev,1/2] reorder: fix ready buffers not being nulled out

Message ID 1505228764-9738-1-git-send-email-pbhagavatula@caviumnetworks.com
State New
Headers show

Checks

Context Check Description
checkpatch success coding style OK
Intel-compilation success Compilation OK

Commit Message

Pavan Bhagavatula Sept. 12, 2017, 3:06 p.m.
The ready buffers should be set to NULL when drained else it might result
in double free (mempool put) when rte_reorder_free is called.

Fixes: b70b56032bff ("reorder: new library")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 lib/librte_reorder/rte_reorder.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/lib/librte_reorder/rte_reorder.c b/lib/librte_reorder/rte_reorder.c
index 010dff6..302eba6 100644
--- a/lib/librte_reorder/rte_reorder.c
+++ b/lib/librte_reorder/rte_reorder.c
@@ -392,6 +392,7 @@  rte_reorder_drain(struct rte_reorder_buffer *b, struct rte_mbuf **mbufs,
 	/* Try to fetch requested number of mbufs from ready buffer */
 	while ((drain_cnt < max_mbufs) && (ready_buf->tail != ready_buf->head)) {
 		mbufs[drain_cnt++] = ready_buf->entries[ready_buf->tail];
+		ready_buf->entries[ready_buf->tail] = NULL;
 		ready_buf->tail = (ready_buf->tail + 1) & ready_buf->mask;
 	}