[PATCH 1/2] reorder: invalidate buf from ready queue in drain

Volodymyr Fialko vfialko at marvell.com
Sat Jan 7 16:19:38 CET 2023


Set drained buffers from ready queue to NULL, since their ownership
returned to user. Otherwise it's possible that both user and library
will attempt to free the packet.

Signed-off-by: Volodymyr Fialko <vfialko at marvell.com>
---
 lib/reorder/rte_reorder.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
index 385ee479da..b38e71f460 100644
--- a/lib/reorder/rte_reorder.c
+++ b/lib/reorder/rte_reorder.c
@@ -389,6 +389,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;
 	}
 
-- 
2.34.1



More information about the dev mailing list