History

Merge branch 'for-3.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu

Pull percpu fix from Tejun Heo: "This contains one patch to fix a race condition which can lead to percpu_ref using a percpu pointer which is corrupted with a set DEAD bit. The bug was introduced while separating out the ATOMIC mode flag from the DEAD flag. The fix is pretty straight forward. I just committed the patch to the percpu tree but am sending out the pull request early as I'll be on vacation for a week. The patch should be fairly safe and while the latency will be higher I'll be checking emails" * 'for-3.18-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu: percpu-ref: fix DEAD flag contamination of percpu pointer

Linus Torvalds committed 11 years ago

Commit 9f2e0f62 parents d038a63 4aab3b51 file · +7 −1Browse files

Unified · Split

include/linux/percpu-refcount.h+7−1
@@ -133,7 +133,13 @@ static inline bool __ref_is_percpu(struct percpu_ref *ref, · 132 unmodified lines
133 /* paired with smp_store_release() in percpu_ref_reinit() */133 /* paired with smp_store_release() in percpu_ref_reinit() */
134 smp_read_barrier_depends();134 smp_read_barrier_depends();
135 135
136 if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC))136 /*
137 * Theoretically, the following could test just ATOMIC; however,
138 * then we'd have to mask off DEAD separately as DEAD may be
139 * visible without ATOMIC if we race with percpu_ref_kill(). DEAD
140 * implies ATOMIC anyway. Test them together.
141 */
142 if (unlikely(percpu_ptr & __PERCPU_REF_ATOMIC_DEAD))
137 return false;143 return false;
138 144
139 *percpu_countp = (unsigned long __percpu *)percpu_ptr;145 *percpu_countp = (unsigned long __percpu *)percpu_ptr;

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