diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-22 14:50:40 -0600 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-04-22 14:55:37 -0600 |
commit | 7e14a4851e099c5ee577b2eca50eebac7d7fbf00 (patch) | |
tree | 0af3fc7ed3f6f0fee12ef48954fcd6e1647af378 /src/compat/ptr_ring | |
parent | 06eb9a6b9abd04481f2a3d561282453b9a1720c8 (diff) |
compat: don't assume READ_ONCE barriers on old kernels
76ebbe78f7390aee075a7f3768af197ded1bdfbb didn't come until 4.15.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/compat/ptr_ring')
-rw-r--r-- | src/compat/ptr_ring/include/linux/ptr_ring.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compat/ptr_ring/include/linux/ptr_ring.h b/src/compat/ptr_ring/include/linux/ptr_ring.h index 417db0a..32aed2b 100644 --- a/src/compat/ptr_ring/include/linux/ptr_ring.h +++ b/src/compat/ptr_ring/include/linux/ptr_ring.h @@ -292,13 +292,13 @@ static inline void *__ptr_ring_consume(struct ptr_ring *r) { void *ptr; - /* The READ_ONCE in __ptr_ring_peek guarantees that anyone - * accessing data through the pointer is up to date. Pairs - * with smp_wmb in __ptr_ring_produce. - */ ptr = __ptr_ring_peek(r); if (ptr) __ptr_ring_discard_one(r); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) + /* The READ_ONCE in __ptr_ring_peek doesn't imply a barrier on old kernels. */ + smp_read_barrier_depends(); +#endif return ptr; } |