mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-21 14:11:56 +00:00
ipn/ipnlocal: fix nil control client panic while updating TKA head
As part of tailnet-lock netmap processing, the LocalBackend mutex is unlocked so we can potentially make a network call. Its possible (during shutdown or while the control client is being reset) for b.cc to become nil before the lock is picked up again. Fixes: #9554 Signed-off-by: Tom DNetto <tom@tailscale.com>
This commit is contained in:
parent
3496d62ed3
commit
11a20f371a
@ -1120,6 +1120,9 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control
|
|||||||
b.logf("[v1] TKA sync error: %v", err)
|
b.logf("[v1] TKA sync error: %v", err)
|
||||||
}
|
}
|
||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
|
// As we stepped outside of the lock, it's possible for b.cc
|
||||||
|
// to now be nil.
|
||||||
|
if b.cc != nil {
|
||||||
if b.tka != nil {
|
if b.tka != nil {
|
||||||
head, err := b.tka.authority.Head().MarshalText()
|
head, err := b.tka.authority.Head().MarshalText()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1130,6 +1133,7 @@ func (b *LocalBackend) SetControlClientStatus(c controlclient.Client, st control
|
|||||||
} else {
|
} else {
|
||||||
b.cc.SetTKAHead("")
|
b.cc.SetTKAHead("")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !envknob.TKASkipSignatureCheck() {
|
if !envknob.TKASkipSignatureCheck() {
|
||||||
b.tkaFilterNetmapLocked(st.NetMap)
|
b.tkaFilterNetmapLocked(st.NetMap)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user