summaryrefslogtreecommitdiffstats
path: root/mm/slab.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2008-06-22 01:46:35 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2008-06-22 01:51:02 +0200
commit481c5346d0981940ee63037eb53e4e37b0735c10 (patch)
tree3fcae626ec4e1d4e698008671cfd62d794992ac5 /mm/slab.c
parentMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tyt... (diff)
downloadlinux-481c5346d0981940ee63037eb53e4e37b0735c10.tar.xz
linux-481c5346d0981940ee63037eb53e4e37b0735c10.zip
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 <clameter@sgi.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slab.c')
-rw-r--r--mm/slab.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 06236e4ddc1b..046607f05f3e 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) {