* [PATCH] percpu: Fix rollback in pcpu_embed_first_chunk()
@ 2012-05-09 12:39 Michael Holzheu
2012-05-09 17:06 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Michael Holzheu @ 2012-05-09 12:39 UTC (permalink / raw)
To: Tejun Heo; +Cc: linux-kernel
From: Michael Holzheu <holzheu@linux.vnet.ibm.com>
Subject: percpu: Fix rollback in pcpu_embed_first_chunk()
The "out_free_areas" rollback in pcpu_embed_first_chunk calls the
free_fn() function for all elements in area[]. This is not correct
because not all elements have been allocated.
To fix this we call free_fn() only for allocated elements.
Signed-off-by: Michael Holzheu <holzheu@linux.vnet.ibm.com>
---
diff --git a/mm/percpu.c b/mm/percpu.c
index f47af91..5a7f631 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -1692,9 +1692,9 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
goto out_free;
out_free_areas:
- for (group = 0; group < ai->nr_groups; group++)
- free_fn(areas[group],
- ai->groups[group].nr_units * ai->unit_size);
+ for (;group > 0; group--)
+ free_fn(areas[group - 1],
+ ai->groups[group - 1].nr_units * ai->unit_size);
out_free:
pcpu_free_alloc_info(ai);
if (areas)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-05-09 17:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-09 12:39 [PATCH] percpu: Fix rollback in pcpu_embed_first_chunk() Michael Holzheu
2012-05-09 17:06 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox