When the initialization of each alg driver failed,
the wd_<alg>_setting.priv should be set to NULL.
Otherwise there will be segment fault when
uninitializing the alg driver.
Signed-off-by: Zhiqi Song <songzhiqi1(a)huawei.com>
---
wd_aead.c | 1 +
wd_cipher.c | 1 +
wd_comp.c | 1 +
wd_dh.c | 1 +
wd_digest.c | 1 +
wd_ecc.c | 1 +
wd_rsa.c | 1 +
7 files changed, 7 insertions(+)
diff --git a/wd_aead.c b/wd_aead.c
index 7a33d4e7..74047b56 100644
--- a/wd_aead.c
+++ b/wd_aead.c
@@ -458,6 +458,7 @@ int wd_aead_init(struct wd_ctx_config *config, struct wd_sched *sched)
out_init:
free(priv);
+ wd_aead_setting.priv = NULL;
out_priv:
wd_uninit_async_request_pool(&wd_aead_setting.pool);
out_sched:
diff --git a/wd_cipher.c b/wd_cipher.c
index 374b05e3..3a9b3234 100644
--- a/wd_cipher.c
+++ b/wd_cipher.c
@@ -299,6 +299,7 @@ int wd_cipher_init(struct wd_ctx_config *config, struct wd_sched *sched)
out_init:
free(priv);
+ wd_cipher_setting.priv = NULL;
out_priv:
wd_uninit_async_request_pool(&wd_cipher_setting.pool);
out_sched:
diff --git a/wd_comp.c b/wd_comp.c
index eb4fa8e5..9a71dfcd 100644
--- a/wd_comp.c
+++ b/wd_comp.c
@@ -145,6 +145,7 @@ int wd_comp_init(struct wd_ctx_config *config, struct wd_sched *sched)
out_init:
free(priv);
+ wd_comp_setting.priv = NULL;
out_priv:
wd_uninit_async_request_pool(&wd_comp_setting.pool);
out_sched:
diff --git a/wd_dh.c b/wd_dh.c
index 193a3f1b..c0d3e007 100644
--- a/wd_dh.c
+++ b/wd_dh.c
@@ -145,6 +145,7 @@ int wd_dh_init(struct wd_ctx_config *config, struct wd_sched *sched)
out_init:
free(priv);
+ wd_dh_setting.priv = NULL;
out_priv:
wd_uninit_async_request_pool(&wd_dh_setting.pool);
out_sched:
diff --git a/wd_digest.c b/wd_digest.c
index 008ab301..17b2923e 100644
--- a/wd_digest.c
+++ b/wd_digest.c
@@ -216,6 +216,7 @@ int wd_digest_init(struct wd_ctx_config *config, struct wd_sched *sched)
out_init:
free(priv);
+ wd_digest_setting.priv = NULL;
out_priv:
wd_uninit_async_request_pool(&wd_digest_setting.pool);
out_sched:
diff --git a/wd_ecc.c b/wd_ecc.c
index 335e953b..af62b9a9 100644
--- a/wd_ecc.c
+++ b/wd_ecc.c
@@ -199,6 +199,7 @@ int wd_ecc_init(struct wd_ctx_config *config, struct wd_sched *sched)
out_init:
free(priv);
+ wd_ecc_setting.priv = NULL;
out_priv:
wd_uninit_async_request_pool(&wd_ecc_setting.pool);
out_sched:
diff --git a/wd_rsa.c b/wd_rsa.c
index 44de4998..83714757 100644
--- a/wd_rsa.c
+++ b/wd_rsa.c
@@ -185,6 +185,7 @@ int wd_rsa_init(struct wd_ctx_config *config, struct wd_sched *sched)
out_init:
free(priv);
+ wd_rsa_setting.priv = NULL;
out_priv:
wd_uninit_async_request_pool(&wd_rsa_setting.pool);
out_sched:
--
2.33.0