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/peer.h | |
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/peer.h')
-rw-r--r-- | src/peer.h | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -62,9 +62,11 @@ struct wireguard_peer { struct wireguard_peer *peer_create(struct wireguard_device *wg, const u8 public_key[NOISE_PUBLIC_KEY_LEN], const u8 preshared_key[NOISE_SYMMETRIC_KEY_LEN]); -struct wireguard_peer *peer_get(struct wireguard_peer *peer); -struct wireguard_peer *peer_rcu_get(struct wireguard_peer *peer); - +struct wireguard_peer * __must_check peer_get_maybe_zero(struct wireguard_peer *peer); +static inline void peer_get(struct wireguard_peer *peer) +{ + kref_get(&peer->refcount); +} void peer_put(struct wireguard_peer *peer); void peer_remove(struct wireguard_peer *peer); void peer_remove_all(struct wireguard_device *wg); |