diff --git a/Changelog.md b/Changelog.md index c05617bb..8ca67e86 100644 --- a/Changelog.md +++ b/Changelog.md @@ -34,6 +34,7 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) * GODT-422 Fix element not found (avoid listing credentials, prefer getting). * GODT-404 Don't keep connections to proxy servers alive if user disables DoH. * Ensure DoH is used at startup to load users for the initial auth. +* Issue causing deadlock when reloading users keys due to double-locking of a mutex. ## [v1.2.7] Donghai-hotfix - beta (2020-05-07) diff --git a/pkg/pmapi/client.go b/pkg/pmapi/client.go index 6af2b530..b483deb8 100644 --- a/pkg/pmapi/client.go +++ b/pkg/pmapi/client.go @@ -154,6 +154,12 @@ func (c *client) Unlock(passphrase []byte) (err error) { c.keyRingLock.Lock() defer c.keyRingLock.Unlock() + return c.unlock(passphrase) +} + +// unlock unlocks the user's keys but without locking the keyring lock first. +// Should only be used internally by methods that first lock the lock. +func (c *client) unlock(passphrase []byte) (err error) { if _, err = c.CurrentUser(); err != nil { return } @@ -181,7 +187,7 @@ func (c *client) ReloadKeys(passphrase []byte) (err error) { c.clearKeys() - return c.Unlock(passphrase) + return c.unlock(passphrase) } func (c *client) clearKeys() {