GIT: unionfs2-2.6.27.y: Fix potential crash with sys_move_pages

Erez Zadok ezk at fsl.cs.sunysb.edu
Thu Aug 12 23:15:04 EDT 2010


commit ffa211737de4c26d0d6fd61091d59acfcac1d03a
Author: Linus Torvalds <torvalds at linux-foundation.org>
Date:   Fri Feb 5 16:16:50 2010 -0800

    Fix potential crash with sys_move_pages
    
    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 at suse.de>
    Acked-and-tested-by: Brice Goglin <Brice.Goglin at inria.fr>
    Acked-by: Hugh Dickins <hugh.dickins at tiscali.co.uk>
    Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
    Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

diff --git a/mm/migrate.c b/mm/migrate.c
index d493c02..96178f4 100644
--- a/mm/migrate.c
+++ b/mm/migrate.c
@@ -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;
 


More information about the unionfs-cvs mailing list