aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/noise.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-12 02:31:11 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-17 19:26:07 +0200
commit7a761528abadea4e5c1be8fe8d73c8538f55cdee (patch)
tree23c6b1a6051378ed3333f64d928b0d65f22c7815 /src/noise.c
parentcompat: just make ro_after_init read_mostly (diff)
downloadwireguard-linux-compat-7a761528abadea4e5c1be8fe8d73c8538f55cdee.tar.xz
wireguard-linux-compat-7a761528abadea4e5c1be8fe8d73c8538f55cdee.zip
noise: no need to take the RCU lock if we're not dereferencing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/noise.c')
-rw-r--r--src/noise.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/noise.c b/src/noise.c
index 72b57cc..8e4f2a6 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -187,10 +187,8 @@ bool noise_received_with_keypair(struct noise_keypairs *keypairs, struct noise_k
bool key_is_new;
struct noise_keypair *old_keypair;
- /* We first check without taking the spinlock but just RCU. */
- rcu_read_lock_bh();
- key_is_new = received_keypair == rcu_dereference_bh(keypairs->next_keypair);
- rcu_read_unlock_bh();
+ /* We first check without taking the spinlock. */
+ key_is_new = received_keypair == rcu_access_pointer(keypairs->next_keypair);
if (likely(!key_is_new))
return false;