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 | 488b7dcba7a5dcf5d65349992c7fc32b3d9c17d1 (patch) | |
tree | 847677cfc90dee98bfe86d64a991f3ff0d8f428d /src/hashtables.c | |
parent | 0c942d003c4291fe05d0de296ac040c7b0d0503c (diff) |
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>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/hashtables.c')
-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; } |