diff options
author | Simon Frei <freisim93@gmail.com> | 2023-11-20 08:12:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-20 08:12:25 +0100 |
commit | 958ff67cccfec6ebac93f5ba90c07d804d916840 (patch) | |
tree | a9e62738b90dbee790e273f4519286d425899c2a | |
parent | 13d9317a386d172960dc9e2f39709d85bdfb22e1 (diff) | |
download | syncthing-958ff67cccfec6ebac93f5ba90c07d804d916840.tar.gz syncthing-958ff67cccfec6ebac93f5ba90c07d804d916840.zip |
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.
-rw-r--r-- | lib/model/model.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/model/model.go b/lib/model/model.go index c8007f61d..64475468d 100644 --- a/lib/model/model.go +++ b/lib/model/model.go @@ -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() |