projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fe102c7
)
percpu_counter: fix CPU unplug race in percpu_counter_destroy()
author
Eric Dumazet
<
[email protected]
>
Tue, 9 Dec 2008 21:14:11 +0000
(13:14 -0800)
committer
Linus Torvalds
<
[email protected]
>
Wed, 10 Dec 2008 16:01:52 +0000
(08:01 -0800)
We should first delete the counter from percpu_counters list
before freeing memory, or a percpu_counter_hotcpu_callback()
could dereference a NULL pointer.
Signed-off-by: Eric Dumazet <
[email protected]
>
Acked-by: David S. Miller <
[email protected]
>
Cc: Peter Zijlstra <
[email protected]
>
Cc: Mingming Cao <
[email protected]
>
Signed-off-by: Andrew Morton <
[email protected]
>
Signed-off-by: Linus Torvalds <
[email protected]
>
lib/percpu_counter.c
patch
|
blob
|
history
diff --git
a/lib/percpu_counter.c
b/lib/percpu_counter.c
index a8663890a88c2e358f21b8cdc6f23a8ebb9d77e5..71b265c330ce364326328151a03fec07c3e9adb0 100644
(file)
--- a/
lib/percpu_counter.c
+++ b/
lib/percpu_counter.c
@@
-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);