Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a227960f authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar
Browse files

locking/mutex: Fix debug_mutexes



debug_mutex_unlock() would bail when !debug_locks and forgets to
actually unlock.

Reported-by: default avatar"Michael L. Semon" <mlsemon35@gmail.com>
Reported-by: default avatar"Kirill A. Shutemov" <kirill@shutemov.name>
Reported-by: default avatarValdis Kletnieks <Valdis.Kletnieks@vt.edu>
Fixes: 6f008e72 ("locking/mutex: Fix debug checks")
Tested-by: default avatarDave Jones <davej@redhat.com>
Cc: Jason Low <jason.low2@hp.com>
Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20140410141559.GE13658@twins.programming.kicks-ass.net


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 467cbd20
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
@@ -71,9 +71,7 @@ void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,

void debug_mutex_unlock(struct mutex *lock)
{
	if (unlikely(!debug_locks))
		return;

	if (likely(debug_locks)) {
		DEBUG_LOCKS_WARN_ON(lock->magic != lock);

		if (!lock->owner)
@@ -83,6 +81,7 @@ void debug_mutex_unlock(struct mutex *lock)

		DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
		mutex_clear_owner(lock);
	}

	/*
	 * __mutex_slowpath_needs_to_unlock() is explicitly 0 for debug