diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-03 22:26:25 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2011-04-03 22:26:25 +0000 |
commit | 6274fc7c801f92795cf001d4987c8cfd121f64ea (patch) | |
tree | 92d69078427bfc0a955f7e268ad9d86283c6e647 /sys/arch/octeon | |
parent | 455e3b46be672b3dd758673ee95f570c6d800508 (diff) |
In mtx_leave(), make sure resetting mtx_lock is the last operation on the
struct mutex. Modelled after hppa.
Diffstat (limited to 'sys/arch/octeon')
-rw-r--r-- | sys/arch/octeon/octeon/mutex.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/arch/octeon/octeon/mutex.c b/sys/arch/octeon/octeon/mutex.c index 1d6ae9a7a6a..52c35e003b4 100644 --- a/sys/arch/octeon/octeon/mutex.c +++ b/sys/arch/octeon/octeon/mutex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mutex.c,v 1.3 2011/04/03 18:46:40 miod Exp $ */ +/* $OpenBSD: mutex.c,v 1.4 2011/04/03 22:26:24 miod Exp $ */ /* * Copyright (c) 2004 Artur Grabowski <art@openbsd.org> @@ -106,11 +106,14 @@ mtx_enter_try(struct mutex *mtx) void mtx_leave(struct mutex *mtx) { + int s; + MUTEX_ASSERT_LOCKED(mtx); #ifdef DIAGNOSTIC curcpu()->ci_mutex_level--; #endif - mtx->mtx_lock = 0; - splx(mtx->mtx_oldipl); + s = mtx->mtx_oldipl; mtx->mtx_owner = NULL; + mtx->mtx_lock = 0; + splx(s); } |