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

Commit 636f13c1 authored by Chris Wright's avatar Chris Wright Committed by Linus Torvalds
Browse files

[PATCH] sys_mbind sanity checking



Make sure maxnodes is safe size before calculating nlongs in
get_nodes().

Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 74910e6c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -808,6 +808,8 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask,
	nodes_clear(*nodes);
	if (maxnode == 0 || !nmask)
		return 0;
	if (maxnode > PAGE_SIZE)
		return -EINVAL;

	nlongs = BITS_TO_LONGS(maxnode);
	if ((maxnode % BITS_PER_LONG) == 0)