core/login: fix potential deadlock for failed logins when user lockout is enabled (#25697)

* core: fix potential deadlock for failed logins

* changelog
This commit is contained in:
Jason O'Donnell
2024-02-29 10:30:27 -05:00
committed by GitHub
parent 7a3f3ba4da
commit fb7f872b76
2 changed files with 5 additions and 1 deletions

3
changelog/25697.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
core/login: Fixed a potential deadlock when a login fails and user lockout is enabled.
```

View File

@@ -2440,6 +2440,8 @@ func (c *Core) LocalGetUserFailedLoginInfo(ctx context.Context, userKey FailedLo
// LocalUpdateUserFailedLoginInfo updates the failed login information for a user based on alias name and mountAccessor
func (c *Core) LocalUpdateUserFailedLoginInfo(ctx context.Context, userKey FailedLoginUser, failedLoginInfo *FailedLoginInfo, deleteEntry bool) error {
c.userFailedLoginInfoLock.Lock()
defer c.userFailedLoginInfoLock.Unlock()
switch deleteEntry {
case false:
// update entry in the map
@@ -2482,7 +2484,6 @@ func (c *Core) LocalUpdateUserFailedLoginInfo(ctx context.Context, userKey Faile
// delete the entry from the map, if no key exists it is no-op
delete(c.userFailedLoginInfo, userKey)
}
c.userFailedLoginInfoLock.Unlock()
return nil
}