From 971f3918a5a8febbbab355079972fb31ee7c0f33 Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Fri, 14 Aug 2009 15:00:49 +0900 Subject: percpu: fix pcpu_reclaim() locking pcpu_reclaim() calls pcpu_depopulate_chunk() which makes use of pages array and bitmap returned by pcpu_get_pages_and_bitmap() and thus should be called under pcpu_alloc_mutex. pcpu_reclaim() released the mutex before calling depopulate leading to double free and other strange problems caused by the unexpected concurrent usages of pages array and bitmap. Fix it. Signed-off-by: Tejun Heo Reviewed-by: Christoph Lameter --- mm/percpu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'mm/percpu.c') diff --git a/mm/percpu.c b/mm/percpu.c index 3f9f182f9b44..42ab0024a6ed 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1181,12 +1181,13 @@ static void pcpu_reclaim(struct work_struct *work) } spin_unlock_irq(&pcpu_lock); - mutex_unlock(&pcpu_alloc_mutex); list_for_each_entry_safe(chunk, next, &todo, list) { pcpu_depopulate_chunk(chunk, 0, pcpu_unit_size); free_pcpu_chunk(chunk); } + + mutex_unlock(&pcpu_alloc_mutex); } /** -- cgit v1.2.3-55-g7522