]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Fix potential crash with sys_move_pages
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 6 Feb 2010 00:16:50 +0000 (16:16 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 1 Apr 2010 22:52:15 +0000 (15:52 -0700)
commit 6f5a55f1a6c5abee15a0e878e5c74d9f1569b8b0 upstream.

We incorrectly depended on the 'node_state/node_isset()' functions
testing the node range, rather than checking it explicitly.  That's not
reliable, even if it might often happen to work.  So do the proper
explicit test.

Reported-by: Marcus Meissner <meissner@suse.de>
Acked-and-tested-by: Brice Goglin <Brice.Goglin@inria.fr>
Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
mm/migrate.c

index d493c02d4e4ac7d5be08da2ed7ecc61a2e1d93ab..96178f4c1215c4ba4f16ec696fa77f20568b004c 100644 (file)
@@ -1062,6 +1062,9 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages,
                                goto out;
 
                        err = -ENODEV;
+                       if (node < 0 || node >= MAX_NUMNODES)
+                               goto out;
+
                        if (!node_state(node, N_HIGH_MEMORY))
                                goto out;