From 694f75bc6665221ef18ae979cac0945200d7ff78 Mon Sep 17 00:00:00 2001 From: yixiangzhike Date: Tue, 2 Jul 2024 10:41:21 +0800 Subject: [PATCH] Fix missing mutex unlock (cherry picked from commit 6030ae94d1b5b7ad6ebd8594bbe38ddab3355b3d) --- backport-fix-missing-mutex-unlock.patch | 43 +++++++++++++++++++++++++ libtomcrypt.spec | 6 +++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 backport-fix-missing-mutex-unlock.patch diff --git a/backport-fix-missing-mutex-unlock.patch b/backport-fix-missing-mutex-unlock.patch new file mode 100644 index 0000000..2d45b09 --- /dev/null +++ b/backport-fix-missing-mutex-unlock.patch @@ -0,0 +1,43 @@ +From ee24a31ae1735c03d58576d2dc43274735c8fbef Mon Sep 17 00:00:00 2001 +From: ycaibb +Date: Fri, 10 Sep 2021 19:44:54 +0800 +Subject: [PATCH] fix missing mutex unlock + +Fixes a missing mutex unlock on an out of memory error +in ltc_ecc_fp_save_state(). + +Originates from: https://github.com/OP-TEE/optee_os/commit/4af447d4084e293800d4e463d65003c016b91f29 + +Fixes #571 + +Comment by sj: +This patch version slightly deviates from the original patch to OP-TEE +since we don't call `XFREE(NULL)` as there exist implementations of +`free()` that don't support it. + +Signed-off-by: Ryan Cai +Reviewed-by: Jens Wiklander +Modified-by: Steffen Jaeckel +--- + src/math/fp/ltc_ecc_fp_mulmod.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/math/fp/ltc_ecc_fp_mulmod.c b/src/math/fp/ltc_ecc_fp_mulmod.c +index 5827bf3b..9be2ebf1 100644 +--- a/src/math/fp/ltc_ecc_fp_mulmod.c ++++ b/src/math/fp/ltc_ecc_fp_mulmod.c +@@ -1429,8 +1429,10 @@ int ltc_ecc_fp_save_state(unsigned char **out, unsigned long *outlen) + * and the mu INTEGER + */ + cache_entry = XCALLOC(FP_ENTRIES*(2*(1U< - 1.18.2-6 +- backport upstream patch to fix missing mutex unlock + * Wed Apr 13 2022 yixiangzhike - 1.18.2-5 - enable test suite in check -- Gitee