Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f5a55f1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Fix potential crash with sys_move_pages



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: default avatarMarcus Meissner <meissner@suse.de>
Acked-and-tested-by: default avatarBrice Goglin <Brice.Goglin@inria.fr>
Acked-by: default avatarHugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: stable@kernel.org
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9d9c3a51
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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;