72 lines
2.2 KiB
Diff
72 lines
2.2 KiB
Diff
|
|
From fe6638d807d10d94ebee234a80e07c498c129fbc Mon Sep 17 00:00:00 2001
|
||
|
|
From: Longfang Liu <liulongfang@huawei.com>
|
||
|
|
Date: Tue, 23 Jul 2024 19:49:15 +0800
|
||
|
|
Subject: [PATCH 10/16] uadk: bugfix CE driver initialization problem
|
||
|
|
|
||
|
|
When using UADK provider, using the default business type TASK_MIX
|
||
|
|
will cause driver initialization to fail.
|
||
|
|
Analysis found that the CE driver will be initialized by fallback,
|
||
|
|
and NULL will be passed to the input parameter during initialization.
|
||
|
|
This NULL parameter will cause a segmentation fault during CE driver
|
||
|
|
initialization.
|
||
|
|
Therefore, initialization is skipped for NULL parameters in the CE driver.
|
||
|
|
|
||
|
|
Signed-off-by: Longfang Liu <liulongfang@huawei.com>
|
||
|
|
Signed-off-by: Qi Tao <taoqi10@huawei.com>
|
||
|
|
---
|
||
|
|
drv/hash_mb/hash_mb.c | 4 ++++
|
||
|
|
drv/isa_ce_sm3.c | 6 +++++-
|
||
|
|
drv/isa_ce_sm4.c | 4 ++++
|
||
|
|
3 files changed, 13 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/drv/hash_mb/hash_mb.c b/drv/hash_mb/hash_mb.c
|
||
|
|
index a73c698..e4a9564 100644
|
||
|
|
--- a/drv/hash_mb/hash_mb.c
|
||
|
|
+++ b/drv/hash_mb/hash_mb.c
|
||
|
|
@@ -192,6 +192,10 @@ static int hash_mb_init(struct wd_alg_driver *drv, void *conf)
|
||
|
|
struct hash_mb_ctx *priv;
|
||
|
|
int ret;
|
||
|
|
|
||
|
|
+ /* Fallback init is NULL */
|
||
|
|
+ if (!drv || !conf)
|
||
|
|
+ return 0;
|
||
|
|
+
|
||
|
|
priv = malloc(sizeof(struct hash_mb_ctx));
|
||
|
|
if (!priv)
|
||
|
|
return -WD_ENOMEM;
|
||
|
|
diff --git a/drv/isa_ce_sm3.c b/drv/isa_ce_sm3.c
|
||
|
|
index 0309861..59f3940 100644
|
||
|
|
--- a/drv/isa_ce_sm3.c
|
||
|
|
+++ b/drv/isa_ce_sm3.c
|
||
|
|
@@ -375,7 +375,11 @@ static int sm3_ce_drv_init(struct wd_alg_driver *drv, void *conf)
|
||
|
|
struct wd_ctx_config_internal *config = (struct wd_ctx_config_internal *)conf;
|
||
|
|
struct sm3_ce_drv_ctx *sctx = (struct sm3_ce_drv_ctx *)drv->priv;
|
||
|
|
|
||
|
|
- config->epoll_en = false;
|
||
|
|
+ /* Fallback init is NULL */
|
||
|
|
+ if (!drv || !conf)
|
||
|
|
+ return 0;
|
||
|
|
+
|
||
|
|
+ config->epoll_en = 0;
|
||
|
|
|
||
|
|
/* return if already inited */
|
||
|
|
if (sctx)
|
||
|
|
diff --git a/drv/isa_ce_sm4.c b/drv/isa_ce_sm4.c
|
||
|
|
index 6961471..e937893 100644
|
||
|
|
--- a/drv/isa_ce_sm4.c
|
||
|
|
+++ b/drv/isa_ce_sm4.c
|
||
|
|
@@ -36,6 +36,10 @@ static int isa_ce_init(struct wd_alg_driver *drv, void *conf)
|
||
|
|
struct wd_ctx_config_internal *config = conf;
|
||
|
|
struct sm4_ce_drv_ctx *sctx = drv->priv;
|
||
|
|
|
||
|
|
+ /* Fallback init is NULL */
|
||
|
|
+ if (!drv || !conf)
|
||
|
|
+ return 0;
|
||
|
|
+
|
||
|
|
config->epoll_en = 0;
|
||
|
|
memcpy(&sctx->config, config, sizeof(struct wd_ctx_config_internal));
|
||
|
|
|
||
|
|
--
|
||
|
|
2.25.1
|
||
|
|
|