diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-02 14:26:28 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-03 14:01:01 +0100 |
commit | 95e2e081ce3d5da5a53b8bc535e2e0322be63f23 (patch) | |
tree | 2ec4e24a437542578e80f96cf69be6afe9e492df /src/config.c | |
parent | 923c05ed149c0aeba12e38aeb59212eb793a936e (diff) |
timers: take reference like a lookup table
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/src/config.c b/src/config.c index 4ca33ce..7f217ff 100644 --- a/src/config.c +++ b/src/config.c @@ -70,16 +70,9 @@ static int set_peer(struct wireguard_device *wg, void __user *user_peer, size_t if (!peer) { /* Peer doesn't exist yet. Add a new one. */ if (in_peer.remove_me) return -ENODEV; /* Tried to remove a non existing peer. */ - peer = peer_create(wg, in_peer.public_key); + peer = peer_rcu_get(peer_create(wg, in_peer.public_key)); if (!peer) return -ENOMEM; - rcu_read_lock(); - peer = peer_get(peer); - rcu_read_unlock(); - if (!peer) { - pr_err("Peer disappeared while creating\n"); - return -EAGAIN; - } if (netdev_pub(wg)->flags & IFF_UP) timers_init_peer(peer); } else |