All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] lib/reorder: fix drain/free issues
@ 2023-01-07 15:19 Volodymyr Fialko
  2023-01-07 15:19 ` [PATCH 1/2] reorder: invalidate buf from ready queue in drain Volodymyr Fialko
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Volodymyr Fialko @ 2023-01-07 15:19 UTC (permalink / raw)
  To: dev; +Cc: jerinj, anoobj, Volodymyr Fialko

This patch address issues with reorder drain/free,
discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.

Volodymyr Fialko (2):
  reorder: invalidate buf from ready queue in drain
  test/reorder: fix double free of drained buffers

 app/test/test_reorder.c   | 2 ++
 lib/reorder/rte_reorder.c | 1 +
 2 files changed, 3 insertions(+)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/2] reorder: invalidate buf from ready queue in drain
  2023-01-07 15:19 [PATCH 0/2] lib/reorder: fix drain/free issues Volodymyr Fialko
@ 2023-01-07 15:19 ` Volodymyr Fialko
  2023-02-07 16:24   ` Stephen Hemminger
  2023-01-07 15:19 ` [PATCH 2/2] test/reorder: fix double free of drained buffers Volodymyr Fialko
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Volodymyr Fialko @ 2023-01-07 15:19 UTC (permalink / raw)
  To: dev, Reshma Pattan; +Cc: jerinj, anoobj, Volodymyr Fialko

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


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/2] test/reorder: fix double free of drained buffers
  2023-01-07 15:19 [PATCH 0/2] lib/reorder: fix drain/free issues Volodymyr Fialko
  2023-01-07 15:19 ` [PATCH 1/2] reorder: invalidate buf from ready queue in drain Volodymyr Fialko
@ 2023-01-07 15:19 ` 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
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 10+ messages in thread
From: Volodymyr Fialko @ 2023-01-07 15:19 UTC (permalink / raw)
  To: dev, Reshma Pattan, David Hunt; +Cc: jerinj, anoobj, Volodymyr Fialko

Set to zero array of drained buffers after free, to prevent freeing them
one more time.
Discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.

Fixes: ecd867faa860 ("test/reorder: fix freeing mbuf twice")

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
 app/test/test_reorder.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c
index f0714a5c18..7b5e590bac 100644
--- a/app/test/test_reorder.c
+++ b/app/test/test_reorder.c
@@ -278,6 +278,7 @@ test_reorder_drain(void)
 		goto exit;
 	}
 	rte_pktmbuf_free(robufs[0]);
+	memset(robufs, 0, sizeof(robufs));
 
 	/* Insert more packets
 	 * RB[] = {NULL, NULL, NULL, NULL}
@@ -313,6 +314,7 @@ test_reorder_drain(void)
 	for (i = 0; i < 3; i++) {
 		rte_pktmbuf_free(robufs[i]);
 	}
+	memset(robufs, 0, sizeof(robufs));
 
 	/*
 	 * RB[] = {NULL, NULL, NULL, NULL}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] lib/reorder: fix drain/free issues
  2023-01-07 15:19 [PATCH 0/2] lib/reorder: fix drain/free issues Volodymyr Fialko
  2023-01-07 15:19 ` [PATCH 1/2] reorder: invalidate buf from ready queue in drain Volodymyr Fialko
  2023-01-07 15:19 ` [PATCH 2/2] test/reorder: fix double free of drained buffers Volodymyr Fialko
@ 2023-01-26 15:47 ` David Marchand
  2023-02-07 11:18   ` Thomas Monjalon
  2023-02-06 15:47 ` Volodymyr Fialko
  2023-02-19 23:19 ` Thomas Monjalon
  4 siblings, 1 reply; 10+ messages in thread
From: David Marchand @ 2023-01-26 15:47 UTC (permalink / raw)
  To: Pattan, Reshma; +Cc: dev, jerinj, anoobj, Volodymyr Fialko

Hi Reshma,

On Sat, Jan 7, 2023 at 4:20 PM Volodymyr Fialko <vfialko@marvell.com> wrote:
>
> This patch address issues with reorder drain/free,
> discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.
>
> Volodymyr Fialko (2):
>   reorder: invalidate buf from ready queue in drain
>   test/reorder: fix double free of drained buffers
>
>  app/test/test_reorder.c   | 2 ++
>  lib/reorder/rte_reorder.c | 1 +
>  2 files changed, 3 insertions(+)

Please review, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] test/reorder: fix double free of drained buffers
  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
  1 sibling, 0 replies; 10+ messages in thread
From: David Marchand @ 2023-01-26 15:51 UTC (permalink / raw)
  To: Volodymyr Fialko; +Cc: dev, Reshma Pattan, David Hunt, jerinj, anoobj, ci

On Sat, Jan 7, 2023 at 4:20 PM Volodymyr Fialko <vfialko@marvell.com> wrote:
>
> Set to zero array of drained buffers after free, to prevent freeing them
> one more time.
> Discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.

Good catch, having those debug options enabled in the CI could be interesting.
Cc: CI people, for info.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: [PATCH 0/2] lib/reorder: fix drain/free issues
  2023-01-07 15:19 [PATCH 0/2] lib/reorder: fix drain/free issues Volodymyr Fialko
                   ` (2 preceding siblings ...)
  2023-01-26 15:47 ` [PATCH 0/2] lib/reorder: fix drain/free issues David Marchand
@ 2023-02-06 15:47 ` Volodymyr Fialko
  2023-02-19 23:19 ` Thomas Monjalon
  4 siblings, 0 replies; 10+ messages in thread
From: Volodymyr Fialko @ 2023-02-06 15:47 UTC (permalink / raw)
  To: dev
  Cc: Jerin Jacob Kollanukkaran, Anoob Joseph, David Marchand,
	Thomas Monjalon, Reshma Pattan

Hi All,

Kind reminder to all maintainers, please review and ack/comment.

> This patch address issues with reorder drain/free, discovered with enabled
> `RTE_LIBRTE_MEMPOOL_DEBUG`.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] lib/reorder: fix drain/free issues
  2023-01-26 15:47 ` [PATCH 0/2] lib/reorder: fix drain/free issues David Marchand
@ 2023-02-07 11:18   ` Thomas Monjalon
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2023-02-07 11:18 UTC (permalink / raw)
  To: dev
  Cc: Pattan, Reshma, jerinj, anoobj, Volodymyr Fialko, David Marchand,
	bruce.richardson, konstantin.v.ananyev, john.mcnamara

Pïng for review

26/01/2023 16:47, David Marchand:
> Hi Reshma,
> 
> On Sat, Jan 7, 2023 at 4:20 PM Volodymyr Fialko <vfialko@marvell.com> wrote:
> >
> > This patch address issues with reorder drain/free,
> > discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.
> >
> > Volodymyr Fialko (2):
> >   reorder: invalidate buf from ready queue in drain
> >   test/reorder: fix double free of drained buffers
> >
> >  app/test/test_reorder.c   | 2 ++
> >  lib/reorder/rte_reorder.c | 1 +
> >  2 files changed, 3 insertions(+)
> 
> Please review, thanks.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/2] reorder: invalidate buf from ready queue in drain
  2023-01-07 15:19 ` [PATCH 1/2] reorder: invalidate buf from ready queue in drain Volodymyr Fialko
@ 2023-02-07 16:24   ` Stephen Hemminger
  0 siblings, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2023-02-07 16:24 UTC (permalink / raw)
  To: Volodymyr Fialko; +Cc: dev, Reshma Pattan, jerinj, anoobj

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>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/2] test/reorder: fix double free of drained buffers
  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
  1 sibling, 0 replies; 10+ messages in thread
From: Stephen Hemminger @ 2023-02-07 16:25 UTC (permalink / raw)
  To: Volodymyr Fialko; +Cc: dev, Reshma Pattan, David Hunt, jerinj, anoobj

On Sat, 7 Jan 2023 16:19:39 +0100
Volodymyr Fialko <vfialko@marvell.com> wrote:

> Set to zero array of drained buffers after free, to prevent freeing them
> one more time.
> Discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.
> 
> Fixes: ecd867faa860 ("test/reorder: fix freeing mbuf twice")
> 
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>

Maybe include the actual test failure log next time.

Looks correct to me.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 0/2] lib/reorder: fix drain/free issues
  2023-01-07 15:19 [PATCH 0/2] lib/reorder: fix drain/free issues Volodymyr Fialko
                   ` (3 preceding siblings ...)
  2023-02-06 15:47 ` Volodymyr Fialko
@ 2023-02-19 23:19 ` Thomas Monjalon
  4 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2023-02-19 23:19 UTC (permalink / raw)
  To: Volodymyr Fialko; +Cc: dev, jerinj, anoobj

07/01/2023 16:19, Volodymyr Fialko:
> This patch address issues with reorder drain/free,
> discovered with enabled `RTE_LIBRTE_MEMPOOL_DEBUG`.
> 
> Volodymyr Fialko (2):
>   reorder: invalidate buf from ready queue in drain
>   test/reorder: fix double free of drained buffers

Applied, thanks.




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-02-19 23:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-07 15:19 [PATCH 0/2] lib/reorder: fix drain/free issues Volodymyr Fialko
2023-01-07 15:19 ` [PATCH 1/2] reorder: invalidate buf from ready queue in drain Volodymyr Fialko
2023-02-07 16:24   ` 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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.