Fix deadlock in IMC/IMV managers
authorTobias Brunner <tobias@strongswan.org>
Tue, 18 Dec 2012 14:50:08 +0000 (15:50 +0100)
committerTobias Brunner <tobias@strongswan.org>
Tue, 18 Dec 2012 14:59:29 +0000 (15:59 +0100)
commit0080daa78789bb7012bc0f80dd6b4ff0d47e41a3
treed0903a2daad39d9354b21dc95a5344b761ec5693
parent6a8eeba5403d4b6005c3a50951046260811c079a
Fix deadlock in IMC/IMV managers

Since reserve_id() might be called from e.g. notify_connection_change()
using a write lock will not work as this can't be acquired while holding
the read lock.

Also, with the previous code it was possible that two IMCs/IMVs added by
two threads at the same time would get the same ID assigned.
src/libcharon/plugins/tnc_imc/tnc_imc_manager.c
src/libcharon/plugins/tnc_imv/tnc_imv_manager.c