summaryrefslogtreecommitdiffstats
path: root/mm/mempolicy.c
diff options
context:
space:
mode:
authorChris Wright2006-02-17 22:59:36 +0100
committerLinus Torvalds2006-02-17 23:09:22 +0100
commit636f13c174dd7c84a437d3c3e8fa66f03f7fda63 (patch)
tree2dd28d7729a52655eb4e155af620c5afdda85a8a /mm/mempolicy.c
parent[PATCH] select: time comparison fixes (diff)
downloadkernel-qcow2-linux-636f13c174dd7c84a437d3c3e8fa66f03f7fda63.tar.gz
kernel-qcow2-linux-636f13c174dd7c84a437d3c3e8fa66f03f7fda63.tar.xz
kernel-qcow2-linux-636f13c174dd7c84a437d3c3e8fa66f03f7fda63.zip
[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>
Diffstat (limited to 'mm/mempolicy.c')
-rw-r--r--mm/mempolicy.c2
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,
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)