From: Victor Julien Date: Tue, 7 Oct 2014 09:25:25 +0000 (+0200) Subject: detect state: always lock de_state_m X-Git-Tag: suricata-2.1beta2~85 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0fff3c833eeee873fbf64057ca85e941c7acbe86;p=thirdparty%2Fsuricata.git detect state: always lock de_state_m Always lock the de_state_m on access, also at flow recycle or cleanup. --- diff --git a/src/flow-util.h b/src/flow-util.h index 5e4a0ae53e..8271c33207 100644 --- a/src/flow-util.h +++ b/src/flow-util.h @@ -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; \ @@ -116,7 +118,9 @@ \ 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); \