From: Christoph Lameter Date: Sat, 21 Jun 2008 23:46:35 +0000 (-0700) Subject: Slab: Fix memory leak in fallback_alloc() X-Git-Tag: v2.6.26-rc8~20 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=481c5346d0981940ee63037eb53e4e37b0735c10;p=linux-2.6 Slab: Fix memory leak in fallback_alloc() The zonelist patches caused the loop that checks for available objects in permitted zones to not terminate immediately. One object per zone per allocation may be allocated and then abandoned. Break the loop when we have successfully allocated one object. Signed-off-by: Christoph Lameter Signed-off-by: Linus Torvalds --- diff --git a/mm/slab.c b/mm/slab.c index 06236e4ddc..046607f05f 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3263,9 +3263,12 @@ retry: if (cpuset_zone_allowed_hardwall(zone, flags) && cache->nodelists[nid] && - cache->nodelists[nid]->free_objects) + cache->nodelists[nid]->free_objects) { obj = ____cache_alloc_node(cache, flags | GFP_THISNODE, nid); + if (obj) + break; + } } if (!obj) {