40 lines
1020 B
Diff
40 lines
1020 B
Diff
From 045807cc13f60a14f0a6ee8de69d54e600491740 Mon Sep 17 00:00:00 2001
|
|
From: Zhiqi Song <songzhiqi1@huawei.com>
|
|
Date: Sat, 17 Jun 2023 20:46:46 +0800
|
|
Subject: [PATCH 23/48] rsa: bugfix repeated source release
|
|
|
|
Set 'g_rsa_res.ctx_res' to NULL when init failed.
|
|
This can avoid repeated source release in uninit
|
|
in abnormal cases.
|
|
|
|
Signed-off-by: Zhiqi Song <songzhiqi1@huawei.com>
|
|
---
|
|
src/uadk_rsa.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/src/uadk_rsa.c b/src/uadk_rsa.c
|
|
index 8669455..bc51e7d 100644
|
|
--- a/src/uadk_rsa.c
|
|
+++ b/src/uadk_rsa.c
|
|
@@ -818,6 +818,7 @@ static int uadk_e_rsa_init(void)
|
|
return UADK_E_INIT_SUCCESS;
|
|
|
|
err_unlock:
|
|
+ g_rsa_res.ctx_res = NULL;
|
|
pthread_spin_unlock(&g_rsa_res.lock);
|
|
free(dev);
|
|
(void)fprintf(stderr, "failed to init rsa(%d)\n", ret);
|
|
@@ -831,6 +832,9 @@ static void uadk_e_rsa_uninit(void)
|
|
__u32 i;
|
|
int ret;
|
|
|
|
+ if (!ctx_cfg)
|
|
+ return;
|
|
+
|
|
if (g_rsa_res.pid == getpid()) {
|
|
ret = uadk_e_is_env_enabled("rsa");
|
|
if (ret == ENV_ENABLED) {
|
|
--
|
|
2.25.1
|
|
|