]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - lib/percpu_counter.c
percpu_counter: fix CPU unplug race in percpu_counter_destroy()
[linux-2.6-omap-h63xx.git] / lib / percpu_counter.c
index a8663890a88c2e358f21b8cdc6f23a8ebb9d77e5..71b265c330ce364326328151a03fec07c3e9adb0 100644 (file)
@@ -104,13 +104,13 @@ void percpu_counter_destroy(struct percpu_counter *fbc)
        if (!fbc->counters)
                return;
 
-       free_percpu(fbc->counters);
-       fbc->counters = NULL;
 #ifdef CONFIG_HOTPLUG_CPU
        mutex_lock(&percpu_counters_lock);
        list_del(&fbc->list);
        mutex_unlock(&percpu_counters_lock);
 #endif
+       free_percpu(fbc->counters);
+       fbc->counters = NULL;
 }
 EXPORT_SYMBOL(percpu_counter_destroy);