wg: Fix noise_remote_alloc() to acquire 'l_identity_lock' lock
authorAaron LI <aly@aaronly.me>
Tue, 16 Jan 2024 12:27:35 +0000 (20:27 +0800)
committerAaron LI <aly@aaronly.me>
Thu, 8 Feb 2024 06:44:47 +0000 (14:44 +0800)
commitc69b9a261b35f1623cf3fc7fa29da229dce32fe3
tree5f994d1e7b4d3fa33f2f57944eaf250cdad950f3
parent05c2812fa3ee03edaba9ac2f326ed89dd28b5275
wg: Fix noise_remote_alloc() to acquire 'l_identity_lock' lock

The 'l_identity_lock' lock must be acquired to access 'l_has_identity'
and 'l_private' members; i.e., noise_precompute_ss() must be called with
the 'l_identity_lock' locked.  So fix noise_remote_alloc() to acquire
the lock before calling noise_precompute_ss().  Meanwhile, add an
assertion to the latter to assert the required lock is held.
sys/net/wg/wg_noise.c