From: Paul Jackson The variable 'k' was changed from 'int' to 'enum zone_type' (unsigned), and it was being tested for being '>= 0' in a loop. Result was that the set_mempolicy(MPOL_BIND) system call crashed the kernel in a near infinite loop off into the weeds. Signed-off-by: Paul Jackson Cc: Christoph Lameter Signed-off-by: Andrew Morton --- mm/mempolicy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff -puN mm/mempolicy.c~apply-type-enum-zone_type-fix mm/mempolicy.c --- a/mm/mempolicy.c~apply-type-enum-zone_type-fix +++ a/mm/mempolicy.c @@ -149,12 +149,16 @@ static struct zonelist *bind_zonelist(no lower zones etc. Avoid empty zones because the memory allocator doesn't like them. If you implement node hot removal you have to fix that. */ - for (k = policy_zone; k >= 0; k--) { + k = policy_zone; + while (1) { for_each_node_mask(nd, *nodes) { struct zone *z = &NODE_DATA(nd)->node_zones[k]; if (z->present_pages > 0) zl->zones[num++] = z; } + if (k == 0) + break; + k--; } zl->zones[num] = NULL; return zl; _