DPDK patches and discussions
 help / color / mirror / Atom feed
* Re: [dpdk-dev] [PATCH] app/test: avoid freeing mbufs twice in qat test
  2016-06-27 12:41 [dpdk-dev] [PATCH] app/test: avoid freeing mbufs twice in qat test Pablo de Lara
@ 2016-06-27 12:38 ` Jain, Deepak K
  2016-06-27 14:44   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Jain, Deepak K @ 2016-06-27 12:38 UTC (permalink / raw)
  To: De Lara Guarch, Pablo, dev; +Cc: De Lara Guarch, Pablo



> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Pablo de Lara
> Sent: Monday, June 27, 2016 1:41 PM
> To: dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>
> Subject: [dpdk-dev] [PATCH] app/test: avoid freeing mbufs twice in qat test
> 
> Test_multi_session was freeing mbufs used in the multiple sessions created
> and setting obuf to NULL after it, but ibuf was not being set to NULL, and
> therefore, it was being freed again (ibuf and obuf are pointing at the same
> address), in the ut_teardown() function.
> 
> Fixes: 1b9cb73ecef1 ("app/test: fix qat autotest failure")
> 
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
>  app/test/test_cryptodev.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> --
> 2.5.0
Acked-by: Deepak K Jain <deepak.k.jain@intel.com>

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

* [dpdk-dev] [PATCH] app/test: avoid freeing mbufs twice in qat test
@ 2016-06-27 12:41 Pablo de Lara
  2016-06-27 12:38 ` Jain, Deepak K
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo de Lara @ 2016-06-27 12:41 UTC (permalink / raw)
  To: dev; +Cc: Pablo de Lara

Test_multi_session was freeing mbufs used in the multiple sessions
created and setting obuf to NULL after it, but ibuf was not being
set to NULL, and therefore, it was being freed again (ibuf and obuf
are pointing at the same address), in the ut_teardown() function.

Fixes: 1b9cb73ecef1 ("app/test: fix qat autotest failure")

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

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 67608ff..9dfe34f 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -3471,12 +3471,19 @@ test_multi_session(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) {
+			rte_pktmbuf_free(ut_params->ibuf);
+			ut_params->ibuf = 0;
+		}
 	}
 
 	/* Next session create should fail */
-- 
2.5.0

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

* Re: [dpdk-dev] [PATCH] app/test: avoid freeing mbufs twice in qat test
  2016-06-27 12:38 ` Jain, Deepak K
@ 2016-06-27 14:44   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2016-06-27 14:44 UTC (permalink / raw)
  To: De Lara Guarch, Pablo; +Cc: dev, Jain, Deepak K

> > Test_multi_session was freeing mbufs used in the multiple sessions created
> > and setting obuf to NULL after it, but ibuf was not being set to NULL, and
> > therefore, it was being freed again (ibuf and obuf are pointing at the same
> > address), in the ut_teardown() function.
> > 
> > Fixes: 1b9cb73ecef1 ("app/test: fix qat autotest failure")
> > 
> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> Acked-by: Deepak K Jain <deepak.k.jain@intel.com>

Applied, thanks

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 12:41 [dpdk-dev] [PATCH] app/test: avoid freeing mbufs twice in qat test Pablo de Lara
2016-06-27 12:38 ` Jain, Deepak K
2016-06-27 14:44   ` 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).