From: Weili Qian <qianweili@huawei.com> To avoid accessing resources after algorithm resources have been released, first stop the poll thread and release asynchronous resources, and finally destroy the algorithm resources. Signed-off-by: Weili Qian <qianweili@huawei.com> --- src/uadk_engine_init.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/uadk_engine_init.c b/src/uadk_engine_init.c index 48498c3..d7d71c8 100644 --- a/src/uadk_engine_init.c +++ b/src/uadk_engine_init.c @@ -223,6 +223,10 @@ static int uadk_destroy(ENGINE *e) kae_debug_close_log(); #endif + pthread_mutex_lock(&uadk_engine_mutex); + if (uadk_cipher || uadk_digest || uadk_rsa || uadk_dh || uadk_ecc) + async_module_uninit(); + if (uadk_cipher) uadk_e_destroy_ciphers(); if (uadk_digest) @@ -234,10 +238,6 @@ static int uadk_destroy(ENGINE *e) if (uadk_dh) uadk_e_destroy_dh(); - if (uadk_cipher || uadk_digest || uadk_rsa || uadk_dh || uadk_ecc) - async_module_uninit(); - - pthread_mutex_lock(&uadk_engine_mutex); uadk_inited = 0; pthread_mutex_unlock(&uadk_engine_mutex); -- 2.43.0