diff --git a/sys/dev/wg/wg_noise.c b/sys/dev/wg/wg_noise.c --- a/sys/dev/wg/wg_noise.c +++ b/sys/dev/wg/wg_noise.c @@ -560,16 +560,16 @@ struct noise_keypair *kp; mtx_lock(&r->r_keypair_mtx); - kp = atomic_load_ptr(&r->r_next); - atomic_store_ptr(&r->r_next, NULL); + kp = r->r_next; + r->r_next = NULL; noise_keypair_drop(kp); - kp = atomic_load_ptr(&r->r_current); - atomic_store_ptr(&r->r_current, NULL); + kp = r->r_current; + r->r_current = NULL; noise_keypair_drop(kp); - kp = atomic_load_ptr(&r->r_previous); - atomic_store_ptr(&r->r_previous, NULL); + kp = r->r_previous; + r->r_previous = NULL; noise_keypair_drop(kp); mtx_unlock(&r->r_keypair_mtx); } @@ -602,24 +602,24 @@ /* Insert into the keypair table */ mtx_lock(&r->r_keypair_mtx); - next = atomic_load_ptr(&r->r_next); - current = atomic_load_ptr(&r->r_current); - previous = atomic_load_ptr(&r->r_previous); + next = r->r_next; + current = r->r_current; + previous = r->r_previous; if (kp->kp_is_initiator) { if (next != NULL) { - atomic_store_ptr(&r->r_next, NULL); - atomic_store_ptr(&r->r_previous, next); + r->r_next = NULL; + r->r_previous = next; noise_keypair_drop(current); } else { - atomic_store_ptr(&r->r_previous, current); + r->r_previous = current; } noise_keypair_drop(previous); - atomic_store_ptr(&r->r_current, kp); + r->r_current = kp; } else { - atomic_store_ptr(&r->r_next, kp); + r->r_next = kp; noise_keypair_drop(next); - atomic_store_ptr(&r->r_previous, NULL); + r->r_previous = NULL; noise_keypair_drop(previous); } @@ -724,20 +724,20 @@ struct noise_keypair *old; struct noise_remote *r = kp->kp_remote; - if (kp != atomic_load_ptr(&r->r_next)) + if (kp != r->r_next) return (0); mtx_lock(&r->r_keypair_mtx); - if (kp != atomic_load_ptr(&r->r_next)) { + if (kp != r->r_next) { mtx_unlock(&r->r_keypair_mtx); return (0); } - old = atomic_load_ptr(&r->r_previous); - atomic_store_ptr(&r->r_previous, atomic_load_ptr(&r->r_current)); + old = r->r_previous; + r->r_previous = r->r_current; noise_keypair_drop(old); - atomic_store_ptr(&r->r_current, kp); - atomic_store_ptr(&r->r_next, NULL); + r->r_current = kp; + r->r_next = NULL; mtx_unlock(&r->r_keypair_mtx); return (ECONNRESET);