lib/model: Acquire fmut lock in ensureIndexHandler (fixes #9234) (#9235)

Towards the end of the function f.folderCfgs and f.folderRunners are
read without the lock.
This commit is contained in:
Simon Frei 2023-11-20 08:12:25 +01:00 committed by GitHub
parent 13d9317a38
commit 958ff67ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -1346,6 +1346,9 @@ func (m *model) ensureIndexHandler(conn protocol.Connection) *indexHandlerRegist
deviceID := conn.DeviceID()
connID := conn.ConnectionID()
// We must acquire fmut first when acquiring both locks.
m.fmut.RLock()
defer m.fmut.RUnlock()
m.pmut.Lock()
defer m.pmut.Unlock()