diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-06-29 17:13:56 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-06-29 17:14:13 +0100 |
commit | 17bb9e0d906b625f86e9d31740bb1c35bc0f63d7 (patch) | |
tree | 2a92b042b2e48be48bbe126ea62ee098fcebc0ee /mm | |
parent | acf4968ec9dea49387ca8b3d36dfaa0850bdb2d5 (diff) |
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: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/kmemleak.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index c37e8e50e4d..e094c4dbdf5 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c @@ -1030,6 +1030,12 @@ static void kmemleak_scan(void) 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. */ rcu_read_lock(); @@ -1184,11 +1190,10 @@ static int kmemleak_seq_show(struct seq_file *seq, void *v) unsigned long flags; spin_lock_irqsave(&object->lock, flags); - if (!unreferenced_object(object)) - goto out; - print_unreferenced(seq, object); - reported_leaks++; -out: + if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) { + print_unreferenced(seq, object); + reported_leaks++; + } spin_unlock_irqrestore(&object->lock, flags); return 0; } |