eal: fix race in control thread creation
authorLuc Pelletier <lucp.at.work@gmail.com>
Wed, 7 Apr 2021 20:16:04 +0000 (16:16 -0400)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 9 Apr 2021 14:36:17 +0000 (16:36 +0200)
commit34cc55cce6b180a6c3ee3fcf70a0fd56927f240d
treeae9bb3dbe44747bf1f2295a7a1786e59a41d01ac
parent76d409ce6e570c330f15d65bc99e49e03476432b
eal: fix race in control thread creation

The creation of control threads uses a pthread barrier for
synchronization. This patch fixes a race condition where the pthread
barrier could get destroyed while one of the threads has not yet
returned from the pthread_barrier_wait function, which could result in
undefined behaviour.

Fixes: 3a0d465d4c53 ("eal: fix use-after-free on control thread creation")
Cc: stable@dpdk.org
Signed-off-by: Luc Pelletier <lucp.at.work@gmail.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
lib/librte_eal/common/eal_common_thread.c