summaryrefslogtreecommitdiffhomepage
path: root/src/noise.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/noise.c')
-rw-r--r--src/noise.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/noise.c b/src/noise.c
index 52a9be3..d6c6398 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -85,7 +85,7 @@ static void keypair_free_kref(struct kref *kref)
{
struct noise_keypair *keypair = container_of(kref, struct noise_keypair, refcount);
index_hashtable_remove(&keypair->entry.peer->device->index_hashtable, &keypair->entry);
- call_rcu(&keypair->rcu, keypair_free_rcu);
+ call_rcu_bh(&keypair->rcu, keypair_free_rcu);
}
void noise_keypair_put(struct noise_keypair *keypair)
@@ -97,7 +97,7 @@ void noise_keypair_put(struct noise_keypair *keypair)
struct noise_keypair *noise_keypair_get(struct noise_keypair *keypair)
{
- RCU_LOCKDEP_WARN(!rcu_read_lock_held(), "Calling noise_keypair_get without holding the RCU read lock.");
+ RCU_LOCKDEP_WARN(!rcu_read_lock_bh_held(), "Calling noise_keypair_get without holding the RCU BH read lock");
if (unlikely(!keypair || !kref_get_unless_zero(&keypair->refcount)))
return NULL;
return keypair;
@@ -167,19 +167,19 @@ bool noise_received_with_keypair(struct noise_keypairs *keypairs, struct noise_k
/* TODO: probably this needs the actual mutex, but we're in atomic context,
* so we can't take it here. Instead we just rely on RCU for the lookups. */
- rcu_read_lock();
- if (unlikely(received_keypair == rcu_dereference(keypairs->next_keypair))) {
+ rcu_read_lock_bh();
+ if (unlikely(received_keypair == rcu_dereference_bh(keypairs->next_keypair))) {
ret = true;
/* When we've finally received the confirmation, we slide the next
* into the current, the current into the previous, and get rid of
* the old previous. */
- old_keypair = rcu_dereference(keypairs->previous_keypair);
- rcu_assign_pointer(keypairs->previous_keypair, rcu_dereference(keypairs->current_keypair));
+ old_keypair = rcu_dereference_bh(keypairs->previous_keypair);
+ rcu_assign_pointer(keypairs->previous_keypair, rcu_dereference_bh(keypairs->current_keypair));
noise_keypair_put(old_keypair);
rcu_assign_pointer(keypairs->current_keypair, received_keypair);
rcu_assign_pointer(keypairs->next_keypair, NULL);
}
- rcu_read_unlock();
+ rcu_read_unlock_bh();
return ret;
}