Skip to content

Commit

Permalink
kmemleak: Do not report new leaked objects if the scanning was stopped
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Catalin Marinas committed Jun 29, 2009
1 parent acf4968 commit 17bb9e0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions mm/kmemleak.c
Original file line number Diff line number Diff line change
Expand Up @@ -1029,6 +1029,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.
*/
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 17bb9e0

Please sign in to comment.