Skip to content

Commit

Permalink
[PATCH] sys_mbind sanity checking
Browse files Browse the repository at this point in the history
Make sure maxnodes is safe size before calculating nlongs in
get_nodes().

Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Chris Wright authored and Linus Torvalds committed Feb 17, 2006
1 parent 74910e6 commit 636f13c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 636f13c

Please sign in to comment.