trap-manager: Wait for install to finish before uninstalling
authorSheena Mira-ato <sheena.mira-ato@alliedtelesis.co.nz>
Wed, 20 Mar 2019 23:30:56 +0000 (12:30 +1300)
committerTobias Brunner <tobias@strongswan.org>
Wed, 27 Mar 2019 08:38:20 +0000 (09:38 +0100)
commit69cbe2ca3fe4d6e6607eac0d2b00a5eb682fe4a0
tree55c2f5bfd2f8ff9dcbb880f109b9321a274d0c50
parent6ec9f68f320e98c733752d16282e354b0d84da1e
trap-manager: Wait for install to finish before uninstalling

There was a race condition between install() and uninstall()
where one thread was in the process of installing a trap
entry, and had destroyed the child_sa, while the other
thread was uninstalling the same trap entry and ended up
trying to destroy the already destroyed child_sa, resulting
in a segmentation fault in the destroy_entry() function.

The uninstall() function needs to wait until all the threads
are done with the installing before proceeding to uninstall
a trap entry.

Closes strongswan/strongswan#131.
src/libcharon/sa/trap_manager.c