summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2007-01-05 16:37:02 -0800
committerChris Wright <chrisw@sous-sol.org>2007-02-05 08:31:39 -0800
commit75cda36db203e982ea134d785ea58d8b56c3aef3 (patch)
tree443d7650454cabc83bd7b5b8cf5091686a1154f1 /mm
parent000883a54755a334c4a1c4ccc4a898eb09a5dff2 (diff)
[PATCH] Check for populated zone in __drain_pages
Both process_zones() and drain_node_pages() check for populated zones before touching pagesets. However, __drain_pages does not do so, This may result in a NULL pointer dereference for pagesets in unpopulated zones if a NUMA setup is combined with cpu hotplug. Initially the unpopulated zone has the pcp pointers pointing to the boot pagesets. Since the zone is not populated the boot pageset pointers will not be changed during page allocator and slab bootstrap. If a cpu is later brought down (first call to __drain_pages()) then the pcp pointers for cpus in unpopulated zones are set to NULL since __drain_pages does not first check for an unpopulated zone. If the cpu is then brought up again then we call process_zones() which will ignore the unpopulated zone. So the pageset pointers will still be NULL. If the cpu is then again brought down then __drain_pages will attempt to drain pages by following the NULL pageset pointer for unpopulated zones. Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/page_alloc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index aa6fcc7ca66f..bf777e4f6be2 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -710,6 +710,9 @@ static void __drain_pages(unsigned int cpu)
for_each_zone(zone) {
struct per_cpu_pageset *pset;
+ if (!populated_zone(zone))
+ continue;
+
pset = zone_pcp(zone, cpu);
for (i = 0; i < ARRAY_SIZE(pset->pcp); i++) {
struct per_cpu_pages *pcp;