The kmemleak_do_cleanup() work thread already waits for the kmemleak_scan
thread to finish via kthread_stop().  Waiting in kthread_stop() while
scan_mutex is held may lead to deadlock if kmemleak_scan_thread() also
waits to acquire for scan_mutex.
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  */
 static void kmemleak_do_cleanup(struct work_struct *work)
 {
-       mutex_lock(&scan_mutex);
        stop_scan_thread();
 
        /*
        else
                pr_info("Kmemleak disabled without freeing internal data. "
                        "Reclaim the memory with \"echo clear > /sys/kernel/debug/kmemleak\"\n");
-       mutex_unlock(&scan_mutex);
 }
 
 static DECLARE_WORK(cleanup_work, kmemleak_do_cleanup);