openssl: Ensure the thread ID is never zero

This might otherwise cause problems because OpenSSL tries to lock
mutexes recursively if it assumes the lock is held by a different
thread e.g. during FIPS initialization.
This commit is contained in:
Tobias Brunner
2012-07-03 12:02:57 +02:00
parent 997fdd1f02
commit 901dbc1077
@@ -129,7 +129,9 @@ static void destroy_function(struct CRYPTO_dynlock_value *lock,
*/
static unsigned long id_function(void)
{
return (unsigned long)thread_current_id();
/* ensure the thread ID is never zero, otherwise OpenSSL might try to
* acquire locks recursively */
return 1 + (unsigned long)thread_current_id();
}
/**