diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-31 07:03:07 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-31 07:19:52 +0200 |
commit | b713ab0e605b4f9291f4fde38103bf689c2cdb76 (patch) | |
tree | e18f74fc2795b8c8b80141e8bf411a8a22959dc2 /src/hashtables.c | |
parent | ratelimiter: prevent init/uninit race (diff) | |
download | wireguard-monolithic-historical-b713ab0e605b4f9291f4fde38103bf689c2cdb76.tar.xz wireguard-monolithic-historical-b713ab0e605b4f9291f4fde38103bf689c2cdb76.zip |
peer: simplify rcu reference counts
Use RCU reference counts only when we must, and otherwise use a more
reasonably named function.
Reported-by: Jann Horn <jann@thejh.net>
Diffstat (limited to '')
-rw-r--r-- | src/hashtables.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hashtables.c b/src/hashtables.c index 0e5235d..ab0f622 100644 --- a/src/hashtables.c +++ b/src/hashtables.c @@ -48,7 +48,7 @@ struct wireguard_peer *pubkey_hashtable_lookup(struct pubkey_hashtable *table, c break; } } - peer = peer_get(peer); + peer = peer_get_maybe_zero(peer); rcu_read_unlock_bh(); return peer; } @@ -159,7 +159,7 @@ struct index_hashtable_entry *index_hashtable_lookup(struct index_hashtable *tab } } if (likely(entry)) { - entry->peer = peer_get(entry->peer); + entry->peer = peer_get_maybe_zero(entry->peer); if (unlikely(!entry->peer)) entry = NULL; } |