diff options
author | Simon Frei <freisim93@gmail.com> | 2023-11-19 20:55:40 +0100 |
---|---|---|
committer | Simon Frei <freisim93@gmail.com> | 2023-11-19 20:57:02 +0100 |
commit | 75d56846dc57d3f2d721fd0c7312fbfea81fb2ca (patch) | |
tree | a9e62738b90dbee790e273f4519286d425899c2a | |
parent | 13d9317a386d172960dc9e2f39709d85bdfb22e1 (diff) | |
download | syncthing-model/fmut-indexhandler.tar.gz syncthing-model/fmut-indexhandler.zip |
lib/model: Acquire fmut lock in ensureIndexHandler (fixes #9234)model/fmut-indexhandler
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() |