mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-30 11:01:09 +02:00
Merge pull request #1627 from hashicorp/rollback-nil-race
Ensure mount/auth tables are not nil when triggering rollback
This commit is contained in:
commit
a68d34100b
@ -192,13 +192,21 @@ func (c *Core) startRollback() error {
|
||||
ret := []*MountEntry{}
|
||||
c.mountsLock.RLock()
|
||||
defer c.mountsLock.RUnlock()
|
||||
for _, entry := range c.mounts.Entries {
|
||||
ret = append(ret, entry)
|
||||
// During teardown/setup after a leader change or unseal there could be
|
||||
// something racy here so make sure the table isn't nil
|
||||
if c.mounts != nil {
|
||||
for _, entry := range c.mounts.Entries {
|
||||
ret = append(ret, entry)
|
||||
}
|
||||
}
|
||||
c.authLock.RLock()
|
||||
defer c.authLock.RUnlock()
|
||||
for _, entry := range c.auth.Entries {
|
||||
ret = append(ret, entry)
|
||||
// During teardown/setup after a leader change or unseal there could be
|
||||
// something racy here so make sure the table isn't nil
|
||||
if c.auth != nil {
|
||||
for _, entry := range c.auth.Entries {
|
||||
ret = append(ret, entry)
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user