aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2015-06-24 19:58:31 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-06-24 20:49:45 -0400
commit5f369f374ba4889fe3c17883402db5ee8d254216 (patch)
tree984086416ed58cc61811fd4f277511b8f720ed1a
parente781a9ab4847a81224667f5faab0b2bc5f78908f (diff)
mm: kmemleak: do not acquire scan_mutex in kmemleak_do_cleanup()
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>
-rw-r--r--mm/kmemleak.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index ecde522ff616..8a57e34625fa 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -1762,7 +1762,6 @@ static void __kmemleak_do_cleanup(void)
1762 */ 1762 */
1763static void kmemleak_do_cleanup(struct work_struct *work) 1763static void kmemleak_do_cleanup(struct work_struct *work)
1764{ 1764{
1765 mutex_lock(&scan_mutex);
1766 stop_scan_thread(); 1765 stop_scan_thread();
1767 1766
1768 /* 1767 /*
@@ -1777,7 +1776,6 @@ static void kmemleak_do_cleanup(struct work_struct *work)
1777 else 1776 else
1778 pr_info("Kmemleak disabled without freeing internal data. " 1777 pr_info("Kmemleak disabled without freeing internal data. "
1779 "Reclaim the memory with \"echo clear > /sys/kernel/debug/kmemleak\"\n"); 1778 "Reclaim the memory with \"echo clear > /sys/kernel/debug/kmemleak\"\n");
1780 mutex_unlock(&scan_mutex);
1781} 1779}
1782 1780
1783static DECLARE_WORK(cleanup_work, kmemleak_do_cleanup); 1781static DECLARE_WORK(cleanup_work, kmemleak_do_cleanup);