[1/2] reorder: invalidate buf from ready queue in drain
Checks
Commit Message
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@marvell.com>
---
lib/reorder/rte_reorder.c | 1 +
1 file changed, 1 insertion(+)
Comments
On Sat, 7 Jan 2023 16:19:38 +0100
Volodymyr Fialko <vfialko@marvell.com> wrote:
> 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@marvell.com>
Looks correct to me.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
@@ -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;
}