Mel Gorman 1368edf064 mm: vmalloc: check for page allocation failure before vmlist insertion
Commit f5252e00 ("mm: avoid null pointer access in vm_struct via
/proc/vmallocinfo") adds newly allocated vm_structs to the vmlist after
it is fully initialised.  Unfortunately, it did not check that
__vmalloc_area_node() successfully populated the area.  In the event of
allocation failure, the vmalloc area is freed but the pointer to freed
memory is inserted into the vmlist leading to a a crash later in
get_vmalloc_info().

This patch adds a check for ____vmalloc_area_node() failure within
__vmalloc_node_range.  It does not use "goto fail" as in the previous
error path as a warning was already displayed by __vmalloc_area_node()
before it called vfree in its failure path.

Credit goes to Luciano Chavez for doing all the real work of identifying
exactly where the problem was.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Reported-by: Luciano Chavez <lnx1138@linux.vnet.ibm.com>
Tested-by: Luciano Chavez <lnx1138@linux.vnet.ibm.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Cc: <stable@vger.kernel.org>		[3.1.x+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-12-09 07:50:29 -08:00
..
2011-03-31 11:26:23 -03:00
2011-07-26 16:49:47 -07:00
2011-11-02 16:06:57 -07:00
2011-10-31 17:30:47 -07:00
2011-07-20 20:47:46 -04:00
2011-10-31 17:30:44 -07:00
2011-10-31 17:30:50 -07:00
2010-05-21 18:31:21 -04:00
2011-03-10 08:52:27 +01:00
2011-07-25 20:57:09 -07:00
2011-05-20 12:50:29 -07:00
2011-10-31 17:30:44 -07:00
2011-12-05 09:44:00 +01:00
2011-10-31 17:30:50 -07:00
2011-10-31 17:30:51 -07:00