History

jump_label: jump_label_inc may return before the code is patched

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/20111018175551.GH17571@redhat.com

Gleb Natapov committed 15 years ago

Commit bbbf7af1 parent c7c6ec81 file · +2 −1Browse files

Unified · Split

kernel/jump_label.c+2−1
@@ -66,8 +66,9 @@ void jump_label_inc(struct jump_label_key *key) · 65 unmodified lines
66 return;66 return;
67 67
68 jump_label_lock();68 jump_label_lock();
69 if (atomic_add_return(1, &key->enabled) == 1)69 if (atomic_read(&key->enabled) == 0)
70 jump_label_update(key, JUMP_LABEL_ENABLE);70 jump_label_update(key, JUMP_LABEL_ENABLE);
71 atomic_inc(&key->enabled);
71 jump_label_unlock();72 jump_label_unlock();
72}73}
73 74

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t