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:
c7c6ec8
)
jump_label: jump_label_inc may return before the code is patched
author
Gleb Natapov
<
[email protected]
>
Tue, 18 Oct 2011 17:55:51 +0000
(19:55 +0200)
committer
Steven Rostedt
<
[email protected]
>
Mon, 5 Dec 2011 18:28:46 +0000
(13:28 -0500)
If cpu A calls jump_label_inc() just after atomic_add_return() is
called by cpu B, atomic_inc_not_zero() will return value greater then
zero and jump_label_inc() will return to a caller before jump_label_update()
finishes its job on cpu B.
Link:
http://lkml.kernel.org/r/
[email protected]
Cc:
[email protected]
Cc: Peter Zijlstra <
[email protected]
>
Acked-by: Jason Baron <
[email protected]
>
Signed-off-by: Gleb Natapov <
[email protected]
>
Signed-off-by: Steven Rostedt <
[email protected]
>
kernel/jump_label.c
patch
|
blob
|
history
diff --git
a/kernel/jump_label.c
b/kernel/jump_label.c
index bbdfe2a462a088b210d5792c674b215274b1b39b..66ff7109f6970ca63cb4aa9bf6b4800d69ef2f3a 100644
(file)
--- a/
kernel/jump_label.c
+++ b/
kernel/jump_label.c
@@
-66,8
+66,9
@@
void jump_label_inc(struct jump_label_key *key)
return;
jump_label_lock();
- if (atomic_
add_return(1, &key->enabled) == 1
)
+ if (atomic_
read(&key->enabled) == 0
)
jump_label_update(key, JUMP_LABEL_ENABLE);
+ atomic_inc(&key->enabled);
jump_label_unlock();
}