提交 17bb9e0d 编写于 作者: C Catalin Marinas

kmemleak: Do not report new leaked objects if the scanning was stopped

If the scanning was stopped with a signal, it is possible that some
objects are left with a white colour (potential leaks) and reported. Add
a check to avoid reporting such objects.
Signed-off-by: NCatalin Marinas <catalin.marinas@arm.com>
上级 acf4968e
...@@ -1029,6 +1029,12 @@ static void kmemleak_scan(void) ...@@ -1029,6 +1029,12 @@ static void kmemleak_scan(void)
} }
WARN_ON(!list_empty(&gray_list)); WARN_ON(!list_empty(&gray_list));
/*
* If scanning was stopped do not report any new unreferenced objects.
*/
if (scan_should_stop())
return;
/* /*
* Scanning result reporting. * Scanning result reporting.
*/ */
...@@ -1184,11 +1190,10 @@ static int kmemleak_seq_show(struct seq_file *seq, void *v) ...@@ -1184,11 +1190,10 @@ static int kmemleak_seq_show(struct seq_file *seq, void *v)
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&object->lock, flags); spin_lock_irqsave(&object->lock, flags);
if (!unreferenced_object(object)) if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) {
goto out;
print_unreferenced(seq, object); print_unreferenced(seq, object);
reported_leaks++; reported_leaks++;
out: }
spin_unlock_irqrestore(&object->lock, flags); spin_unlock_irqrestore(&object->lock, flags);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册