]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stats: walk tv_root under lock
authorVictor Julien <victor@inliniac.net>
Wed, 12 Jun 2019 05:45:38 +0000 (07:45 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 17 Jun 2019 18:06:50 +0000 (20:06 +0200)
src/counters.c

index 3880043c76e6b525fd0f9f6184a6f26d655c10b9..ac350a0719d0325b08d2575e24cbe4f98c9695a1 100644 (file)
@@ -478,6 +478,7 @@ static void *StatsWakeupThread(void *arg)
         SCCtrlCondTimedwait(tv_local->ctrl_cond, tv_local->ctrl_mutex, &cond_time);
         SCCtrlMutexUnlock(tv_local->ctrl_mutex);
 
+        SCMutexLock(&tv_root_lock);
         ThreadVars *tv = tv_root[TVT_PPT];
         while (tv != NULL) {
             if (tv->perf_public_ctx.head == NULL) {
@@ -511,6 +512,7 @@ static void *StatsWakeupThread(void *arg)
 
             tv = tv->next;
         }
+        SCMutexUnlock(&tv_root_lock);
 
         if (TmThreadsCheckFlag(tv_local, THV_KILL)) {
             break;