From b710f2dd59fbfc676ad3b3ee9f444d23bb3a8b13 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Thu, 26 Feb 2015 15:23:41 +0100 Subject: [PATCH] detect-state: cleanup ContinueDetection Only lock f->de_state->m when we start to access it. So after declaration and initialization of local vars. --- src/detect-engine-state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/detect-engine-state.c b/src/detect-engine-state.c index 61445a6981..1dd213c3af 100644 --- a/src/detect-engine-state.c +++ b/src/detect-engine-state.c @@ -486,8 +486,6 @@ void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, Packet *p, Flow *f, uint8_t flags, AppProto alproto, uint16_t alversion) { - SCMutexLock(&f->de_state_m); - DetectEngineAppInspectionEngine *engine = NULL; SigMatch *sm = NULL; uint16_t file_no_match = 0; @@ -502,8 +500,6 @@ void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, int match = 0; uint8_t alert = 0; - DetectEngineStateDirection *dir_state = &f->de_state->dir_state[flags & STREAM_TOSERVER ? 0 : 1]; - DeStateStore *store = dir_state->head; void *inspect_tx = NULL; uint64_t inspect_tx_id = 0; uint64_t total_txs = 0; @@ -514,6 +510,10 @@ void DeStateDetectContinueDetection(ThreadVars *tv, DetectEngineCtx *de_ctx, * assume that we have an alert if engine == NULL */ uint8_t total_matches = 0; + SCMutexLock(&f->de_state_m); + DetectEngineStateDirection *dir_state = &f->de_state->dir_state[flags & STREAM_TOSERVER ? 0 : 1]; + DeStateStore *store = dir_state->head; + DeStateResetFileInspection(f, alproto, alstate, flags); if (AppLayerParserProtocolSupportsTxs(f->proto, alproto)) {