]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect state: always lock de_state_m
authorVictor Julien <victor@inliniac.net>
Tue, 7 Oct 2014 09:25:25 +0000 (11:25 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 7 Oct 2014 09:25:25 +0000 (11:25 +0200)
Always lock the de_state_m on access, also at flow recycle or
cleanup.

src/flow-util.h

index 5e4a0ae53ed8aad32ad0dc33db21b4ee9edc9408..8271c33207981db0eb94a3210d9c03062f43363c 100644 (file)
@@ -98,7 +98,9 @@
         (f)->data_al_so_far[1] = 0; \
         (f)->de_ctx_id = 0; \
         if ((f)->de_state != NULL) { \
+            SCMutexLock(&(f)->de_state_m); \
             DetectEngineStateReset((f)->de_state, (STREAM_TOSERVER | STREAM_TOCLIENT)); \
+            SCMutexUnlock(&(f)->de_state_m); \
         } \
         (f)->sgh_toserver = NULL; \
         (f)->sgh_toclient = NULL; \
         \
         FLOWLOCK_DESTROY((f)); \
         if ((f)->de_state != NULL) { \
+            SCMutexLock(&(f)->de_state_m); \
             DetectEngineStateFree((f)->de_state); \
+            SCMutexUnlock(&(f)->de_state_m); \
         } \
         GenericVarFree((f)->flowvar); \
         SCMutexDestroy(&(f)->de_state_m); \