]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
dtrace: fix mutex_owned() implementation
authorKris Van Hees <kris.van.hees@oracle.com>
Tue, 22 Oct 2013 09:24:09 +0000 (05:24 -0400)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:29:22 +0000 (15:29 +0100)
The mutex_owned() function was not accounting for the possibility that a lock
might have an owner registered while unlocked.

Orabug: 17624236

Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Acked-by: Dave Kleikamp <dave.kleikamp@oracle.com>
include/linux/mutex.h

index 479a770d44450d09013a01babbd655c74a5e41f8..b3ef508a120eba953682c8d3ce3fcda9b9796aff 100644 (file)
@@ -182,7 +182,7 @@ extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);
 #if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP)
 static inline int mutex_owned(struct mutex *lock)
 {
-       return lock->owner == current;
+       return mutex_is_locked(lock) && lock->owner == current;
 }
 #else
 static inline int mutex_owned(struct mutex *lock)