apply type enum zone_type fix
Subsystems (2)
PATCH 1/1 apply type enum zone_type fix
From: Paul Jackson <[email protected]>
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 <[email protected]>
---
mm/mempolicy.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
mm/mempolicy.c +5 -1
@@ -149,12 +149,16 @@ static struct zonelist *bind_zonelist(nolower 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;
Signature · 3 lines
I won't rest till it's the best ...
Programmer, Linux Scalability
Paul Jackson <[email protected]> 1.650.933.1373