aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/peer.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/peer.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/peer.c')
-rw-r--r--src/peer.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/peer.c b/src/peer.c
index 4264fa0..cd093b4 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -49,7 +49,7 @@ struct wireguard_peer *peer_create(struct wireguard_device *wg, const u8 public_
struct wireguard_peer *peer_get(struct wireguard_peer *peer)
{
- RCU_LOCKDEP_WARN(!rcu_read_lock_held(), "Calling peer_get without holding the RCU read lock.");
+ RCU_LOCKDEP_WARN(!rcu_read_lock_bh_held(), "Calling peer_get without holding the RCU read lock");
if (unlikely(!peer || !kref_get_unless_zero(&peer->refcount)))
return NULL;
return peer;
@@ -57,9 +57,9 @@ struct wireguard_peer *peer_get(struct wireguard_peer *peer)
struct wireguard_peer *peer_rcu_get(struct wireguard_peer *peer)
{
- rcu_read_lock();
+ rcu_read_lock_bh();
peer = peer_get(peer);
- rcu_read_unlock();
+ rcu_read_unlock_bh();
return peer;
}
@@ -95,7 +95,7 @@ static void rcu_release(struct rcu_head *rcu)
static void kref_release(struct kref *refcount)
{
struct wireguard_peer *peer = container_of(refcount, struct wireguard_peer, refcount);
- call_rcu(&peer->rcu, rcu_release);
+ call_rcu_bh(&peer->rcu, rcu_release);
}
void peer_put(struct wireguard_peer *peer)