-stable review patch. If anyone has any objections, please let us know. ------------------ Make sure maxnodes is safe size before calculating nlongs in get_nodes(). Signed-off-by: Chris Wright Signed-off-by: Linus Torvalds [chrisw: fix units, pointed out by Andi] Cc: Andi Kleen Signed-off-by: Greg Kroah-Hartman --- mm/mempolicy.c | 2 ++ 1 files changed, 2 insertions(+) --- linux-2.6.15.4.orig/mm/mempolicy.c +++ linux-2.6.15.4/mm/mempolicy.c @@ -524,6 +524,8 @@ static int get_nodes(nodemask_t *nodes, 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) --