libwd/0111-uadk-v1-fix-wd_rng-resource-release-bug.patch
Younger 5c995b2464 libwd - update some patches
Update some patches for 2203-SP3 only.

Signed-off-by: Yang Shen <shenyang39@huawei.com>
2024-05-24 09:59:01 +08:00

41 lines
1.1 KiB
Diff

From 229d6b81c9ac88bc3152bbdad07da247ff1261f2 Mon Sep 17 00:00:00 2001
From: Qi Tao <taoqi10@huawei.com>
Date: Mon, 4 Dec 2023 17:30:23 +0800
Subject: [PATCH 111/123] uadk v1: fix wd_rng resource release bug
Before wd_free_id and ctx_num are released, check
whether ctx_num is less than or equal to 0 to
avoid repeated release.
Signed-off-by: Chenghai Huang <huangchenghai2@huawei.com>
---
v1/wd_rng.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/v1/wd_rng.c b/v1/wd_rng.c
index 927665f..24a4b7a 100644
--- a/v1/wd_rng.c
+++ b/v1/wd_rng.c
@@ -144,14 +144,14 @@ void wcrypto_del_rng_ctx(void *ctx)
wd_uninit_cookie_pool(&cx->pool);
wd_spinlock(&qinfo->qlock);
- wd_free_id(qinfo->ctx_id, WD_MAX_CTX_NUM, cx->ctx_id - 1,
- WD_MAX_CTX_NUM);
- qinfo->ctx_num--;
- if (qinfo->ctx_num < 0) {
+ if (qinfo->ctx_num <= 0) {
wd_unspinlock(&qinfo->qlock);
WD_ERR("repeat delete trng ctx!\n");
return;
}
+ qinfo->ctx_num--;
+ wd_free_id(qinfo->ctx_id, WD_MAX_CTX_NUM, cx->ctx_id - 1,
+ WD_MAX_CTX_NUM);
wd_unspinlock(&qinfo->qlock);
free(ctx);
--
2.31.1.windows.1