[lkml]   [2011]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[18/53] mm: vmalloc: check for page allocation failure before vmlist insertion
    3.1-stable review patch.  If anyone has any objections, please let me know.


    From: Mel Gorman <>

    commit 1368edf0647ac112d8cfa6ce47257dc950c50f5c upstream.

    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

    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 <>
    Reported-by: Luciano Chavez <>
    Tested-by: Luciano Chavez <>
    Reviewed-by: Rik van Riel <>
    Acked-by: David Rientjes <>
    Signed-off-by: Andrew Morton <>
    Signed-off-by: Linus Torvalds <>
    Signed-off-by: Greg Kroah-Hartman <>

    mm/vmalloc.c | 2 ++
    1 file changed, 2 insertions(+)

    --- a/mm/vmalloc.c
    +++ b/mm/vmalloc.c
    @@ -1634,6 +1634,8 @@ void *__vmalloc_node_range(unsigned long
    return NULL;

    addr = __vmalloc_area_node(area, gfp_mask, prot, node, caller);
    + if (!addr)
    + return NULL;

    * In this function, newly allocated vm_struct is not added

     \ /
      Last update: 2011-12-16 21:11    [W:0.051 / U:5.704 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site