kmemleak: Do not return a pointer to an object that kmemleak did not get
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 27 Apr 2011 15:44:26 +0000 (16:44 +0100)
committerSteve Conklin <sconklin@canonical.com>
Fri, 15 Jul 2011 17:20:45 +0000 (12:20 -0500)
commit2cc4b72d85dcec389db444a19580ff0600161a2f
tree7c63884757d70ea3e4a1e878c2f9e234f9753ef9
parent66acc9a25a50751d3e681cbd80d68187f97b3d71
kmemleak: Do not return a pointer to an object that kmemleak did not get

BugLink: http://bugs.launchpad.net/bugs/793702

commit 52c3ce4ec5601ee383a14f1485f6bac7b278896e upstream.

The kmemleak_seq_next() function tries to get an object (and increment
its use count) before returning it. If it could not get the last object
during list traversal (because it may have been freed), the function
should return NULL rather than a pointer to such object that it did not
get.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Acked-by: Phil Carmody <ext-phil.2.carmody@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
mm/kmemleak.c