aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/noise.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-10-25 14:49:32 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-25 14:49:32 +0200
commit6fedf35005ddeec21a73fb299e1f5a2cd772f96b (patch)
treedc259e2dcc7c74505807723c22585405e9ddd896 /src/noise.c
parentpeer: another peer_remove cleanup (diff)
downloadwireguard-monolithic-historical-6fedf35005ddeec21a73fb299e1f5a2cd772f96b.tar.xz
wireguard-monolithic-historical-6fedf35005ddeec21a73fb299e1f5a2cd772f96b.zip
global: do not allow compiler to reorder is_valid or is_dead
Suggested-by: Jann Horn <jann@thejh.net>
Diffstat (limited to 'src/noise.c')
-rw-r--r--src/noise.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/noise.c b/src/noise.c
index 4160fc0..d0a337a 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -775,8 +775,8 @@ bool wg_noise_handshake_begin_session(struct noise_handshake *handshake,
handshake_zero(handshake);
rcu_read_lock_bh();
- if (likely(!container_of(handshake, struct wg_peer,
- handshake)->is_dead)) {
+ if (likely(!READ_ONCE(container_of(handshake, struct wg_peer,
+ handshake)->is_dead))) {
add_new_keypair(keypairs, new_keypair);
net_dbg_ratelimited("%s: Keypair %llu created for peer %llu\n",
handshake->entry.peer->device->dev->name,