magicsock: fix deadlock in SetStaticEndpoints (#17247)

updates tailscale/corp#32600

A localAPI/cli call to reload-config can end up leaving magicsock's mutex
locked.   We were missing an unlock for the early exit where there's no change in
the static endpoints when the disk-based config is loaded.  This is not likely
the root cause of the linked issue - just noted during investigation.

Signed-off-by: Jonathan Nobels <jonathan@tailscale.com>
This commit is contained in:
Jonathan Nobels 2025-09-23 13:35:22 -04:00 committed by GitHub
parent 1791f87870
commit 4af15a1148
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1015,6 +1015,7 @@ func (c *Conn) setEndpoints(endpoints []tailcfg.Endpoint) (changed bool) {
func (c *Conn) SetStaticEndpoints(ep views.Slice[netip.AddrPort]) { func (c *Conn) SetStaticEndpoints(ep views.Slice[netip.AddrPort]) {
c.mu.Lock() c.mu.Lock()
if reflect.DeepEqual(c.staticEndpoints.AsSlice(), ep.AsSlice()) { if reflect.DeepEqual(c.staticEndpoints.AsSlice(), ep.AsSlice()) {
c.mu.Unlock()
return return
} }
c.staticEndpoints = ep c.staticEndpoints = ep