--- zzzz-none-000/linux-4.1.38/kernel/locking/mutex-debug.c 2017-01-18 18:48:06.000000000 +0000 +++ bcm63-7582-715/linux-4.1.38/kernel/locking/mutex-debug.c 2020-11-25 10:06:48.000000000 +0000 @@ -72,6 +72,17 @@ void debug_mutex_unlock(struct mutex *lock) { if (likely(debug_locks)) { +#if defined(CONFIG_BCM_KF_MUTEX_FIX) + /* + * debug_locks is set to 0 by add_taint() when a proprietary module + * is loaded. But mutex owner is recorded regardless of debug_locks + * or proprietary module. We just need to clear the owner so that + * our own mutex assert code works. + */ + if (unlikely(!debug_locks)) + mutex_clear_owner(lock); +#endif + DEBUG_LOCKS_WARN_ON(lock->magic != lock); if (!lock->owner)