DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/test: avoid freeing mbuf twice
@ 2016-06-25 16:11 Pablo de Lara
  2016-06-27 10:40 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo de Lara @ 2016-06-25 16:11 UTC (permalink / raw)
  To: dev; +Cc: Pablo de Lara

In cryptodev tests, when input and output buffers were the same,
the mbuf was being freed twice, causing refcnt_atomic to be negative.

Fixes: 202d375c60bc ("app/test: add cryptodev unit and performance tests")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 app/test/test_cryptodev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 1a67ffb..67608ff 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -396,10 +396,13 @@ ut_teardown(void)
 
 	/*
 	 * free mbuf - both obuf and ibuf are usually the same,
-	 * but rte copes even if we call free twice
+	 * so check if they point at the same address is necessary,
+	 * to avoid freeing the mbuf twice.
 	 */
 	if (ut_params->obuf) {
 		rte_pktmbuf_free(ut_params->obuf);
+		if (ut_params->ibuf == ut_params->obuf)
+			ut_params->ibuf = 0;
 		ut_params->obuf = 0;
 	}
 	if (ut_params->ibuf) {
-- 
2.5.0

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

* Re: [dpdk-dev] [PATCH] app/test: avoid freeing mbuf twice
  2016-06-25 16:11 [dpdk-dev] [PATCH] app/test: avoid freeing mbuf twice Pablo de Lara
@ 2016-06-27 10:40 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-06-27 10:40 UTC (permalink / raw)
  To: Pablo de Lara; +Cc: dev

2016-06-25 17:11, Pablo de Lara:
> In cryptodev tests, when input and output buffers were the same,
> the mbuf was being freed twice, causing refcnt_atomic to be negative.
> 
> Fixes: 202d375c60bc ("app/test: add cryptodev unit and performance tests")
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Applied, thanks

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

end of thread, other threads:[~2016-06-27 10:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-25 16:11 [dpdk-dev] [PATCH] app/test: avoid freeing mbuf twice Pablo de Lara
2016-06-27 10:40 ` Thomas Monjalon

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).