From 6c51343dba4d3059e18b047ee52d1219c2ab7816 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 1 Aug 2018 19:09:18 +0200 Subject: 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 --- src/receive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/receive.c') diff --git a/src/receive.c b/src/receive.c index 5e231c9..12af8ed 100644 --- a/src/receive.c +++ b/src/receive.c @@ -382,7 +382,7 @@ int packet_rx_poll(struct napi_struct *napi, int budget) if (unlikely(budget <= 0)) return 0; - while ((skb = __ptr_ring_peek(&queue->ring)) != NULL && (state = atomic_read(&PACKET_CB(skb)->state)) != PACKET_STATE_UNCRYPTED) { + while ((skb = __ptr_ring_peek(&queue->ring)) != NULL && (state = atomic_read_acquire(&PACKET_CB(skb)->state)) != PACKET_STATE_UNCRYPTED) { __ptr_ring_discard_one(&queue->ring); peer = PACKET_PEER(skb); keypair = PACKET_CB(skb)->keypair; -- cgit v1.2.3-59-g8ed1b