wgengine/magicsock: fix magicsock deadlock around Conn.NoteRecvActivity (#16687)

Updates #16651
Updates tailscale/corp#30836

Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
Jordan Whited
2025-07-28 09:26:24 -07:00
committed by GitHub
parent 5ce3845a02
commit a9f3fd1c67
2 changed files with 6 additions and 2 deletions

View File

@@ -4119,8 +4119,11 @@ func (le *lazyEndpoint) InitiationMessagePublicKey(peerPublicKey [32]byte) {
return
}
le.c.mu.Lock()
defer le.c.mu.Unlock()
ep, ok := le.c.peerMap.endpointForNodeKey(pubKey)
// [Conn.mu] must not be held while [Conn.noteRecvActivity] is called, which
// [endpoint.noteRecvActivity] can end up calling. See
// [Options.NoteRecvActivity] docs.
le.c.mu.Unlock()
if !ok {
return
}