diff options
author | Chris Wright <chrisw@sous-sol.org> | 2006-02-17 13:59:36 -0800 |
---|---|---|
committer | Chris Wright <chrisw@sous-sol.org> | 2006-03-01 14:36:35 -0800 |
commit | 99e1baf86ff6a31330ff0c7bb77110338f03ddc5 (patch) | |
tree | 75b8502ec51fa67468ccb56f46ec852081e0795e | |
parent | 8fef8ea2a1f28a7611ad0b8ff7b48ceb38db9535 (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>
[chrisw: fix units, pointed out by Andi]
Cc: Andi Kleen <ak@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-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 72f402cc9c9..6e870ba707c 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -524,6 +524,8 @@ static int get_nodes(nodemask_t *nodes, unsigned long __user *nmask, nodes_clear(*nodes); if (maxnode == 0 || !nmask) return 0; + if (maxnode > PAGE_SIZE*BITS_PER_BYTE) + return -EINVAL; nlongs = BITS_TO_LONGS(maxnode); if ((maxnode % BITS_PER_LONG) == 0) |