diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-12 02:31:11 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2017-10-17 19:26:07 +0200 |
commit | 7a761528abadea4e5c1be8fe8d73c8538f55cdee (patch) | |
tree | 23c6b1a6051378ed3333f64d928b0d65f22c7815 | |
parent | cff9537454ad09a2eca964902f80d53126a3d8be (diff) |
noise: no need to take the RCU lock if we're not dereferencing
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/noise.c | 6 |
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; |