DPDK patches and discussions
 help / color / mirror / Atom feed
From: Volodymyr Fialko <vfialko@marvell.com>
To: <dev@dpdk.org>, Reshma Pattan <reshma.pattan@intel.com>
Cc: <jerinj@marvell.com>, <anoobj@marvell.com>,
	Volodymyr Fialko <vfialko@marvell.com>
Subject: [PATCH 1/2] reorder: invalidate buf from ready queue in drain
Date: Sat, 7 Jan 2023 16:19:38 +0100	[thread overview]
Message-ID: <20230107151939.2540148-2-vfialko@marvell.com> (raw)
In-Reply-To: <20230107151939.2540148-1-vfialko@marvell.com>

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(+)

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


  reply	other threads:[~2023-01-07 15:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-07 15:19 [PATCH 0/2] lib/reorder: fix drain/free issues Volodymyr Fialko
2023-01-07 15:19 ` Volodymyr Fialko [this message]
2023-02-07 16:24   ` [PATCH 1/2] reorder: invalidate buf from ready queue in drain Stephen Hemminger
2023-01-07 15:19 ` [PATCH 2/2] test/reorder: fix double free of drained buffers Volodymyr Fialko
2023-01-26 15:51   ` David Marchand
2023-02-07 16:25   ` Stephen Hemminger
2023-01-26 15:47 ` [PATCH 0/2] lib/reorder: fix drain/free issues David Marchand
2023-02-07 11:18   ` Thomas Monjalon
2023-02-06 15:47 ` Volodymyr Fialko
2023-02-19 23:19 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230107151939.2540148-2-vfialko@marvell.com \
    --to=vfialko@marvell.com \
    --cc=anoobj@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=reshma.pattan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).