From ca9d8072dfeeff971555b2dca3f6ec490442d0a9 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Fri, 23 Sep 2022 07:09:07 +0200 Subject: [PATCH] posix env: assert in rwsem unlock Instead of ignoring `pthread_rwlock_unlock()` return value assert that is must succeed. The function returns an error eg. when there is an attempt to unlock the resource from a different thread than it was originally locked which is illegal in userspace. Signed-off-by: Michal Mielewczyk --- env/posix/ocf_env.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env/posix/ocf_env.h b/env/posix/ocf_env.h index 4fa163a..e1ab63e 100644 --- a/env/posix/ocf_env.h +++ b/env/posix/ocf_env.h @@ -306,7 +306,7 @@ static inline int env_rwsem_init(env_rwsem *s) static inline void env_rwsem_up_read(env_rwsem *s) { - pthread_rwlock_unlock(&s->lock); + ENV_BUG_ON(pthread_rwlock_unlock(&s->lock)); } static inline void env_rwsem_down_read(env_rwsem *s)