diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-05 23:02:14 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-06-05 23:29:34 +0200 |
commit | 5158e2c0f4f93a3b1a9dbce39a8b011732a71141 (patch) | |
tree | 73e76c3adefbc03d7ba347c47f93ac89ff84cdd8 /src/wg_noise.c | |
parent | ci: test on 12.1 and 12.2 (diff) | |
download | wireguard-freebsd-5158e2c0f4f93a3b1a9dbce39a8b011732a71141.tar.xz wireguard-freebsd-5158e2c0f4f93a3b1a9dbce39a8b011732a71141.zip |
global: destroy rwlocks and mtxs
Before, most uses of rwlock and mtx never called the destroy method,
which might cause problems for witness.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to '')
-rw-r--r-- | src/wg_noise.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wg_noise.c b/src/wg_noise.c index 41f7f50..35784be 100644 --- a/src/wg_noise.c +++ b/src/wg_noise.c @@ -220,6 +220,9 @@ noise_local_put(struct noise_local *l) if (refcount_release(&l->l_refcnt)) { if (l->l_cleanup != NULL) l->l_cleanup(l); + rw_destroy(&l->l_identity_lock); + rw_destroy(&l->l_remote_lock); + rw_destroy(&l->l_index_lock); explicit_bzero(l, sizeof(*l)); free(l, M_NOISE); } @@ -468,6 +471,8 @@ noise_remote_smr_free(struct epoch_context *smr) if (r->r_cleanup != NULL) r->r_cleanup(r); noise_local_put(r->r_local); + rw_destroy(&r->r_handshake_lock); + rw_destroy(&r->r_keypair_lock); explicit_bzero(r, sizeof(*r)); free(r, M_NOISE); } @@ -749,6 +754,7 @@ noise_keypair_smr_free(struct epoch_context *smr) struct noise_keypair *kp; kp = __containerof(smr, struct noise_keypair, kp_smr); noise_remote_put(kp->kp_remote); + rw_destroy(&kp->kp_nonce_lock); explicit_bzero(kp, sizeof(*kp)); free(kp, M_NOISE); } |