diff mbox series

[1/2] net/ark: fix leak on thread termination

Message ID 20210506094452.1689-2-david.marchand@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series Thread termination leak fixes | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

David Marchand May 6, 2021, 9:44 a.m. UTC
A terminated pthread should be joined or detached so that its associated
resources are released.

The "ark-delay-pg" thread is just used to delay some task but it is never
joined by the thread that created it.
The easiest solution is to detach the new thread.

Fixes: 727b3fe292bc ("net/ark: integrate PMD")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/ark/ark_pktgen.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ed Czeck May 11, 2021, 5:55 p.m. UTC | #1
Thank you.

Acked-by: Ed Czeck <ed.czeck@atomicrules.com>


On Thu, May 6, 2021 at 5:45 AM David Marchand <david.marchand@redhat.com>
wrote:

> A terminated pthread should be joined or detached so that its associated
> resources are released.
>
> The "ark-delay-pg" thread is just used to delay some task but it is never
> joined by the thread that created it.
> The easiest solution is to detach the new thread.
>
> Fixes: 727b3fe292bc ("net/ark: integrate PMD")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>  drivers/net/ark/ark_pktgen.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
> index 28a44f7546..515bfe461c 100644
> --- a/drivers/net/ark/ark_pktgen.c
> +++ b/drivers/net/ark/ark_pktgen.c
> @@ -3,6 +3,7 @@
>   */
>
>  #include <unistd.h>
> +#include <pthread.h>
>
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
> @@ -474,6 +475,7 @@ ark_pktgen_delay_start(void *arg)
>          * perform a blind sleep here to ensure that the external test
>          * application has time to setup the test before we generate
> packets
>          */
> +       pthread_detach(pthread_self());
>         usleep(100000);
>         ark_pktgen_run(inst);
>         return NULL;
> --
> 2.23.0
>
>
diff mbox series

Patch

diff --git a/drivers/net/ark/ark_pktgen.c b/drivers/net/ark/ark_pktgen.c
index 28a44f7546..515bfe461c 100644
--- a/drivers/net/ark/ark_pktgen.c
+++ b/drivers/net/ark/ark_pktgen.c
@@ -3,6 +3,7 @@ 
  */
 
 #include <unistd.h>
+#include <pthread.h>
 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
@@ -474,6 +475,7 @@  ark_pktgen_delay_start(void *arg)
 	 * perform a blind sleep here to ensure that the external test
 	 * application has time to setup the test before we generate packets
 	 */
+	pthread_detach(pthread_self());
 	usleep(100000);
 	ark_pktgen_run(inst);
 	return NULL;