diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-05 16:16:50 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-04-01 15:55:25 -0700 |
commit | 45468a60ffdcc00758b849e651adc2329c86fd85 (patch) | |
tree | 8b92617d0942cf5fff74deefe77f164155be38ee /mm | |
parent | 5e20b95750867086fff98e5c3eaa00c3bc01d8ee (diff) |
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@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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/migrate.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mm/migrate.c b/mm/migrate.c index 598abad88f97..eebfb79d7748 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -937,6 +937,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; |