diff --git a/src/detect-engine.c b/src/detect-engine.c index 543e140c19..f77452873a 100644 --- a/src/detect-engine.c +++ b/src/detect-engine.c @@ -2303,6 +2303,7 @@ static void InjectPackets( * * If called in unix socket mode, it's possible that we don't have * detect threads yet. + * NOTE: master MUST be locked before calling this * * \retval -1 error * \retval 0 no detection threads @@ -4859,8 +4860,13 @@ int DetectEngineReload(const SCInstance *suri) DetectEngineDeReference(&old_de_ctx); SCLogDebug("going to reload the threads to use new_de_ctx %p", new_de_ctx); + + DetectEngineMasterCtx *master = &g_master_de_ctx; + SCMutexLock(&master->lock); /* update the threads */ DetectEngineReloadThreads(new_de_ctx); + SCMutexUnlock(&master->lock); + SCLogDebug("threads now run new_de_ctx %p", new_de_ctx); /* walk free list, freeing the old_de_ctx */