From: Andi Kleen Fix ABI in set_mempolicy() that got broken by an earlier change. Add a check for very big input values and prevent excessive looping in the kernel. Signed-off-by: Andrew Morton --- 25-akpm/mm/mempolicy.c | 3 +++ 1 files changed, 3 insertions(+) diff -puN mm/mempolicy.c~fix-abi-in-set_mempolicy mm/mempolicy.c --- 25/mm/mempolicy.c~fix-abi-in-set_mempolicy 2004-09-13 00:15:56.177650848 -0700 +++ 25-akpm/mm/mempolicy.c 2004-09-13 00:15:56.181650240 -0700 @@ -132,6 +132,7 @@ static int get_nodes(unsigned long *node unsigned long nlongs; unsigned long endmask; + --maxnode; bitmap_zero(nodes, MAX_NUMNODES); if (maxnode == 0 || !nmask) return 0; @@ -145,6 +146,8 @@ static int get_nodes(unsigned long *node /* When the user specified more nodes than supported just check if the non supported part is all zero. */ if (nlongs > BITS_TO_LONGS(MAX_NUMNODES)) { + if (nlongs > PAGE_SIZE/sizeof(long)) + return -EINVAL; for (k = BITS_TO_LONGS(MAX_NUMNODES); k < nlongs; k++) { unsigned long t; if (get_user(t, nmask + k)) _