Commit 481c5346 authored by Christoph Lameter's avatar Christoph Lameter Committed by Linus Torvalds

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: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 62a8efe6
...@@ -3263,9 +3263,12 @@ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags) ...@@ -3263,9 +3263,12 @@ static void *fallback_alloc(struct kmem_cache *cache, gfp_t flags)
if (cpuset_zone_allowed_hardwall(zone, flags) && if (cpuset_zone_allowed_hardwall(zone, flags) &&
cache->nodelists[nid] && cache->nodelists[nid] &&
cache->nodelists[nid]->free_objects) cache->nodelists[nid]->free_objects) {
obj = ____cache_alloc_node(cache, obj = ____cache_alloc_node(cache,
flags | GFP_THISNODE, nid); flags | GFP_THISNODE, nid);
if (obj)
break;
}
} }
if (!obj) { if (!obj) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment