numa: fix slab_node(MPOL_BIND)
authorEric Dumazet <eric.dumazet@gmail.com>
Wed, 27 Oct 2010 17:33:43 +0000 (19:33 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Oct 2010 17:04:30 +0000 (10:04 -0700)
When a node contains only HighMem memory, slab_node(MPOL_BIND)
dereferences a NULL pointer.

[ This code seems to go back all the way to commit 19770b32609b: "mm:
  filter based on a nodemask as well as a gfp_mask".  Which was back in
  April 2008, and it got merged into 2.6.26.  - Linus ]

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Christoph Lameter <cl@linux.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mempolicy.c

index 81a127643aea889675e9570ebee5653833e55e95..4a57f135b76e74741e7c7d285642067a3e18efe6 100644 (file)
@@ -1597,7 +1597,7 @@ unsigned slab_node(struct mempolicy *policy)
                (void)first_zones_zonelist(zonelist, highest_zoneidx,
                                                        &policy->v.nodes,
                                                        &zone);
-               return zone->node;
+               return zone ? zone->node : numa_node_id();
        }
 
        default: