[CRIU] [PATCH 2/2] lock: prevent unlocking an unlocked mutex
Andrey Vagin
avagin at openvz.org
Tue Jan 29 02:06:33 EST 2013
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
include/lock.h | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/include/lock.h b/include/lock.h
index 515655e..2a1f9af 100644
--- a/include/lock.h
+++ b/include/lock.h
@@ -128,7 +128,12 @@ static void inline mutex_lock(mutex_t *m)
static void inline mutex_unlock(mutex_t *m)
{
u32 c = 0;
- atomic_set(&m->raw, c);
+ int ret;
+ ret = atomic_set(&m->raw, c);
+ if (ret == 0) {
+ pr_err("Unlock an unlocked mutex\n");
+ BUG();
+ }
BUG_ON(sys_futex(&m->raw.counter, FUTEX_WAKE, 1, NULL, NULL, 0) < 0);
}
--
1.7.11.7
More information about the CRIU
mailing list