Skip to content

Commit

Permalink
Fix potential crash with sys_move_pages
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-and-tested-by: Brice Goglin <[email protected]>
Acked-by: Hugh Dickins <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
torvalds committed Feb 6, 2010
1 parent 9d9c3a5 commit 6f5a55f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 6f5a55f

Please sign in to comment.