summaryrefslogtreecommitdiffhomepage
path: root/src/receive.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-04-03 05:20:25 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-04-04 03:44:35 +0200
commitf7d65b3268ec8f11d0fbf455ce8f7b00b0f79c47 (patch)
treee7ddc04349076e5432dd196a4472e04b8bd4811b /src/receive.c
parentbf71248a46a64955c53b59fe6bcbc9c35094d1c6 (diff)
locking: always use _bh
All locks are potentially between user context and softirq, which means we need to take the _bh variant. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/receive.c')
-rw-r--r--src/receive.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/receive.c b/src/receive.c
index f791a2e..3b375ae 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -192,12 +192,12 @@ static void keep_key_fresh(struct wireguard_peer *peer)
if (peer->sent_lastminute_handshake)
return;
- rcu_read_lock();
- keypair = rcu_dereference(peer->keypairs.current_keypair);
+ rcu_read_lock_bh();
+ keypair = rcu_dereference_bh(peer->keypairs.current_keypair);
if (likely(keypair && keypair->sending.is_valid) && keypair->i_am_the_initiator &&
unlikely(time_is_before_eq_jiffies64(keypair->sending.birthdate + REJECT_AFTER_TIME - KEEPALIVE_TIMEOUT - REKEY_TIMEOUT)))
send = true;
- rcu_read_unlock();
+ rcu_read_unlock_bh();
if (send) {
peer->sent_lastminute_handshake = true;