From 958ff67cccfec6ebac93f5ba90c07d804d916840 Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Mon, 20 Nov 2023 08:12:25 +0100 Subject: [PATCH] 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. --- lib/model/model.go | 3 +++ 1 file changed, 3 insertions(+) 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()