aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/noise.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-11-02 06:32:03 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-11-02 06:32:03 +0100
commit303ac6d412b4578cbe74c884aa81138cb45d9625 (patch)
tree425f3ce2583a439d34bc0bd9c0f5a73941c3b6a5 /src/noise.c
parentdata: do not allow usage of keypair just before hash removal (diff)
downloadwireguard-monolithic-historical-303ac6d412b4578cbe74c884aa81138cb45d9625.tar.xz
wireguard-monolithic-historical-303ac6d412b4578cbe74c884aa81138cb45d9625.zip
kref: elide checks
Diffstat (limited to 'src/noise.c')
-rw-r--r--src/noise.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/noise.c b/src/noise.c
index cefedee..886a1e7 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -98,9 +98,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.");
- if (unlikely(!keypair))
- return NULL;
- if (unlikely(!kref_get_unless_zero(&keypair->refcount)))
+ if (unlikely(!keypair || !kref_get_unless_zero(&keypair->refcount)))
return NULL;
return keypair;
}