[pkg-opensc-commit] [libp11] 29/51: Another workaround for an engine code deadlock
Eric Dorland
eric at moszumanska.debian.org
Wed Dec 7 17:51:32 UTC 2016
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository libp11.
commit 689bd3cc852bcd3e3e1c15f42949a4a577e29dbb
Author: Michał Trojnara <Michal.Trojnara at stunnel.org>
Date: Thu Oct 27 06:52:23 2016 +0200
Another workaround for an engine code deadlock
See #123 for details
---
src/eng_back.c | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/eng_back.c b/src/eng_back.c
index 3b2cd42..f13f290 100644
--- a/src/eng_back.c
+++ b/src/eng_back.c
@@ -165,13 +165,6 @@ int pkcs11_destroy(ENGINE_CTX *ctx)
{
if (ctx) {
pkcs11_finish(ctx);
- if (ctx->pkcs11_ctx) {
- /* Modules cannot be unloaded in pkcs11_finish()
- * because of a deadlock in PKCS#11 modules that
- * internally use the OpenSSL engine interface */
- PKCS11_CTX_unload(ctx->pkcs11_ctx);
- PKCS11_CTX_free(ctx->pkcs11_ctx);
- }
destroy_pin(ctx);
OPENSSL_free(ctx->module);
OPENSSL_free(ctx->init_args);
@@ -276,6 +269,15 @@ int pkcs11_finish(ENGINE_CTX *ctx)
ctx->slot_list = NULL;
ctx->slot_count = 0;
}
+ if (ctx->pkcs11_ctx) {
+ /* Modules cannot be unloaded in pkcs11_finish() nor
+ * pkcs11_destroy() because of a deadlock in PKCS#11
+ * modules that internally use OpenSSL engines.
+ * A memory leak is better than a deadlock... */
+ /* PKCS11_CTX_unload(ctx->pkcs11_ctx); */
+ PKCS11_CTX_free(ctx->pkcs11_ctx);
+ ctx->pkcs11_ctx = NULL;
+ }
}
return 1;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/libp11.git
More information about the pkg-opensc-commit
mailing list