mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
locking/mutex: Fix debug_mutexes
debug_mutex_unlock() would bail when !debug_locks and forgets to actually unlock. Reported-by: "Michael L. Semon" <mlsemon35@gmail.com> Reported-by: "Kirill A. Shutemov" <kirill@shutemov.name> Reported-by: Valdis Kletnieks <Valdis.Kletnieks@vt.edu> Fixes: 6f008e72cd11 ("locking/mutex: Fix debug checks") Tested-by: Dave Jones <davej@redhat.com> Cc: Jason Low <jason.low2@hp.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20140410141559.GE13658@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
parent
467cbd207a
commit
a227960fe0
@ -71,18 +71,17 @@ void mutex_remove_waiter(struct mutex *lock, struct mutex_waiter *waiter,
|
|||||||
|
|
||||||
void debug_mutex_unlock(struct mutex *lock)
|
void debug_mutex_unlock(struct mutex *lock)
|
||||||
{
|
{
|
||||||
if (unlikely(!debug_locks))
|
if (likely(debug_locks)) {
|
||||||
return;
|
DEBUG_LOCKS_WARN_ON(lock->magic != lock);
|
||||||
|
|
||||||
DEBUG_LOCKS_WARN_ON(lock->magic != lock);
|
if (!lock->owner)
|
||||||
|
DEBUG_LOCKS_WARN_ON(!lock->owner);
|
||||||
|
else
|
||||||
|
DEBUG_LOCKS_WARN_ON(lock->owner != current);
|
||||||
|
|
||||||
if (!lock->owner)
|
DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
|
||||||
DEBUG_LOCKS_WARN_ON(!lock->owner);
|
mutex_clear_owner(lock);
|
||||||
else
|
}
|
||||||
DEBUG_LOCKS_WARN_ON(lock->owner != current);
|
|
||||||
|
|
||||||
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
|
* __mutex_slowpath_needs_to_unlock() is explicitly 0 for debug
|
||||||
|
Loading…
x
Reference in New Issue
Block a user