kmemleak: Do not return a pointer to an object that kmemleak did not get
commit3e768cc47e031b7b28cd0f70257d403aedc8d2c5
authorCatalin Marinas <catalin.marinas@arm.com>
Wed, 27 Apr 2011 15:44:26 +0000 (27 16:44 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 3 Jun 2011 01:33:32 +0000 (3 10:33 +0900)
tree66603b87769b9715da1c757d84fdee8440c0742c
parent1c6dfdb912ee90ce3d20db20fec032e06a4315dd
kmemleak: Do not return a pointer to an object that kmemleak did not get

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>
mm/kmemleak.c