aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/send.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-08-01 19:09:18 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-08-02 07:40:26 +0200
commit6c51343dba4d3059e18b047ee52d1219c2ab7816 (patch)
treeb40bf8a9c937622d7c22824490a6e9057ceeb6b0 /src/send.c
parentqueueing: document double-adding and reference conditions (diff)
downloadwireguard-monolithic-historical-6c51343dba4d3059e18b047ee52d1219c2ab7816.tar.xz
wireguard-monolithic-historical-6c51343dba4d3059e18b047ee52d1219c2ab7816.zip
queueing: ensure strictly ordered loads and stores
We don't want a consumer to read plaintext when it's supposed to be reading ciphertext, which means we need to synchronize across cores. Suggested-by: Jann Horn <jann@thejh.net>
Diffstat (limited to 'src/send.c')
-rw-r--r--src/send.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/send.c b/src/send.c
index 823b344..788ff60 100644
--- a/src/send.c
+++ b/src/send.c
@@ -223,7 +223,7 @@ void packet_tx_worker(struct work_struct *work)
struct sk_buff *first;
enum packet_state state;
- while ((first = __ptr_ring_peek(&queue->ring)) != NULL && (state = atomic_read(&PACKET_CB(first)->state)) != PACKET_STATE_UNCRYPTED) {
+ while ((first = __ptr_ring_peek(&queue->ring)) != NULL && (state = atomic_read_acquire(&PACKET_CB(first)->state)) != PACKET_STATE_UNCRYPTED) {
__ptr_ring_discard_one(&queue->ring);
peer = PACKET_PEER(first);
keypair = PACKET_CB(first)->keypair;