* [PATCH] mutex-debug: Check mutex magic before owner
@ 2008-04-23 5:38 Jeremy Kerr
0 siblings, 0 replies; only message in thread
From: Jeremy Kerr @ 2008-04-23 5:38 UTC (permalink / raw)
To: linux-kernel; +Cc: mingo
Currently, the mutex debug code checks the lock->owner before
lock->magic, so a corrupt mutex will most likely result in
failing the owner check, rather than the magic check.
This change to debug_mutex_unlock does the magic check first, so
we have a better idea of what breaks.
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
kernel/mutex-debug.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/mutex-debug.c b/kernel/mutex-debug.c
index 3aaa06c..1d94160 100644
--- a/kernel/mutex-debug.c
+++ b/kernel/mutex-debug.c
@@ -79,8 +79,8 @@ void debug_mutex_unlock(struct mutex *lock)
if (unlikely(!debug_locks))
return;
- DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
DEBUG_LOCKS_WARN_ON(lock->magic != lock);
+ DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
DEBUG_LOCKS_WARN_ON(lock->owner != current_thread_info());
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2008-04-23 5:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-23 5:38 [PATCH] mutex-debug: Check mutex magic before owner Jeremy Kerr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®