diff options
author | Chris Wright <chrisw@sous-sol.org> | 2006-02-17 16:59:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-17 17:09:22 -0500 |
commit | 636f13c174dd7c84a437d3c3e8fa66f03f7fda63 (patch) | |
tree | 2dd28d7729a52655eb4e155af620c5afdda85a8a | |
parent | 74910e6c7dc7471b286a883c1a7af70483ffd2ba (diff) |
[PATCH] sys_mbind sanity checking
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>
-rw-r--r-- | mm/mempolicy.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 323fdcf128c4..bedfa4f09c80 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -808,6 +808,8 @@ static int get_nodes(nodemask_t *nodes, const unsigned long __user *nmask, | |||
808 | nodes_clear(*nodes); | 808 | nodes_clear(*nodes); |
809 | if (maxnode == 0 || !nmask) | 809 | if (maxnode == 0 || !nmask) |
810 | return 0; | 810 | return 0; |
811 | if (maxnode > PAGE_SIZE) | ||
812 | return -EINVAL; | ||
811 | 813 | ||
812 | nlongs = BITS_TO_LONGS(maxnode); | 814 | nlongs = BITS_TO_LONGS(maxnode); |
813 | if ((maxnode % BITS_PER_LONG) == 0) | 815 | if ((maxnode % BITS_PER_LONG) == 0) |