control/controlclient: eliminate race in loginGoal access.

This code is currently racy due to an incorrect assumption
that goal is never modified in-place, so does not require extra locking.
This change makes the assumption correct.

Signed-off-by: Dmytro Shynkevych <dmytro@tailscale.com>
reviewable/pr560/r1
Dmytro Shynkevych 4 years ago
parent 19d77ce6a3
commit d361511512
No known key found for this signature in database
GPG Key ID: FF5E2F3DAD97EA23

@ -355,12 +355,13 @@ func (c *Client) authRoutine() {
err = fmt.Errorf("weird: server required a new url?")
report(err, "WaitLoginURL")
}
goal.url = url
goal.token = nil
goal.flags = LoginDefault
c.mu.Lock()
c.loginGoal = goal
c.loginGoal = &LoginGoal{
wantLoggedIn: true,
flags: LoginDefault,
url: url,
}
c.state = StateURLVisitRequired
c.synced = false
c.mu.Unlock()

Loading…
Cancel
Save