From 51ecfd6673e264541f471d9663cb512a8a0a59d5 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Wed, 15 May 2024 16:41:40 +0900 Subject: [PATCH] libc-wasi: Fix a locking botch (#3437) --- .../libc-wasi/sandboxed-system-primitives/src/posix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c index 03ff50a3..627bbbb3 100644 --- a/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c +++ b/core/iwasm/libraries/libc-wasi/sandboxed-system-primitives/src/posix.c @@ -650,8 +650,10 @@ fd_table_insert(wasm_exec_env_t exec_env, struct fd_table *ft, __wasi_errno_t error = fd_table_unused(ft, out); - if (error != __WASI_ESUCCESS) + if (error != __WASI_ESUCCESS) { + rwlock_unlock(&ft->lock); return error; + } fd_table_attach(ft, *out, fo, rights_base, rights_inheriting); rwlock_unlock(&ft->lock);