]> git.ipfire.org Git - thirdparty/strongswan.git/commit
pkcs11: Call C_Finalize() to cancel jobs waiting in C_WaitForSlotEvent()
authorTobias Brunner <tobias@strongswan.org>
Fri, 6 Oct 2017 12:51:37 +0000 (14:51 +0200)
committerTobias Brunner <tobias@strongswan.org>
Thu, 2 Nov 2017 09:15:32 +0000 (10:15 +0100)
commit6ce7ae24a4b9d95c88870245a5b6cfac2155a085
tree31fb9d5371feefe476d9572b4f4258ce0a339d2c
parentbf23ca09cbdb3e53f2f0cf786d325dffe605bd57
pkcs11: Call C_Finalize() to cancel jobs waiting in C_WaitForSlotEvent()

This is not ideal as the call to C_Finalize() should be the last one via
the PKCS#11 API.  Since the order in which jobs are canceled is undefined
we can't be sure there is no other thread still using the library (it could
even be the canceled job that still handles a previous slot event).
According to PKCS#11 the behavior of C_Finalize() is undefined while other
threads still make calls over the API.

However, canceling the thread, as done previously, could also be problematic
as PKCS#11 libraries could hold locks while in the C_WaitForSlotEvent() call,
which might not get released properly when the thread is just canceled,
and which then might cause later calls to other API functions to block.

Fixes #2437.
src/libstrongswan/plugins/pkcs11/pkcs11_manager.c