aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/data.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
commit293e9d604f949db9501d0ce01570350198e59c0b (patch)
treed9d02ae5be1ebc9eb7e76c90baa781e45e9189fe /src/data.c
parentqemu: new stable kernel (diff)
downloadwireguard-monolithic-historical-293e9d604f949db9501d0ce01570350198e59c0b.tar.xz
wireguard-monolithic-historical-293e9d604f949db9501d0ce01570350198e59c0b.zip
locking: always use _bh
All locks are potentially between user context and softirq, which means we need to take the _bh variant.
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/data.c b/src/data.c
index dcbbd10..4751eb8 100644
--- a/src/data.c
+++ b/src/data.c
@@ -282,11 +282,11 @@ int packet_create_data(struct sk_buff_head *queue, struct wireguard_peer *peer,
struct noise_keypair *keypair;
struct sk_buff *skb;
- rcu_read_lock();
- keypair = noise_keypair_get(rcu_dereference(peer->keypairs.current_keypair));
+ rcu_read_lock_bh();
+ keypair = noise_keypair_get(rcu_dereference_bh(peer->keypairs.current_keypair));
if (unlikely(!keypair))
goto err_rcu;
- rcu_read_unlock();
+ rcu_read_unlock_bh();
skb_queue_walk(queue, skb) {
if (unlikely(!get_encryption_nonce(&PACKET_CB(skb)->nonce, &keypair->sending)))
@@ -338,7 +338,7 @@ err:
noise_keypair_put(keypair);
return ret;
err_rcu:
- rcu_read_unlock();
+ rcu_read_unlock_bh();
return ret;
}
@@ -421,9 +421,9 @@ void packet_consume_data(struct sk_buff *skb, struct wireguard_device *wg, packe
__le32 idx = ((struct message_data *)skb->data)->key_idx;
ret = -EINVAL;
- rcu_read_lock();
+ rcu_read_lock_bh();
keypair = noise_keypair_get((struct noise_keypair *)index_hashtable_lookup(&wg->index_hashtable, INDEX_HASHTABLE_KEYPAIR, idx));
- rcu_read_unlock();
+ rcu_read_unlock_bh();
if (unlikely(!keypair))
goto err;