mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] apply type enum zone_type fix
@ 2006-08-06 14:32 Paul Jackson
  0 siblings, 0 replies; only message in thread
From: Paul Jackson @ 2006-08-06 14:32 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Christoph Hellwig, Con Kolivas, Marcelo Tosatti,
	Arjan van de Ven, linux-kernel, Nick Piggin, Christoph Lameter,
	KAMEZAWA Hiroyuki, Paul Jackson, Andi Kleen

From: Paul Jackson <pj@sgi.com>

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 <pj@sgi.com>

---

 mm/mempolicy.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

--- 2.6.18-rc3-mm1.orig/mm/mempolicy.c	2006-08-06 06:41:41.622684572 -0700
+++ 2.6.18-rc3-mm1/mm/mempolicy.c	2006-08-06 06:42:53.419522620 -0700
@@ -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;

-- 
                          I won't rest till it's the best ...
                          Programmer, Linux Scalability
                          Paul Jackson <pj@sgi.com> 1.650.933.1373

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-08-06 14:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-06 14:32 [PATCH] apply type enum zone_type fix Paul Jackson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®