Fix potential crash with sys_move_pages
[linux-2.6.git] / mm / migrate.c
index efddbf0926b283ae5ef292e076ff9900842c4dd5..9a0db5bbabe4c93c0fce3ee7c24f13f2fbf84dc0 100644 (file)
@@ -912,6 +912,9 @@ static int do_pages_move(struct mm_struct *mm, struct task_struct *task,
                                goto out_pm;
 
                        err = -ENODEV;
+                       if (node < 0 || node >= MAX_NUMNODES)
+                               goto out_pm;
+
                        if (!node_state(node, N_HIGH_MEMORY))
                                goto out_pm;