]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect-flowint: conditional locking
authorVictor Julien <victor@inliniac.net>
Fri, 20 Mar 2015 15:22:19 +0000 (16:22 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 20 Mar 2015 18:07:29 +0000 (19:07 +0100)
src/detect-flowint.c

index e829eaac061279eb805fdf5da061dd953d1db07c..6328b67572a2c1c0cd07db273a6051f02b53e157 100644 (file)
@@ -107,13 +107,15 @@ error:
 int DetectFlowintMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx,
                         Packet *p, Signature *s, const SigMatchCtx *ctx)
 {
+    const int flow_locked = det_ctx->flow_locked;
     const DetectFlowintData *sfd = (const DetectFlowintData *)ctx;
     FlowVar *fv;
     FlowVar *fvt;
     uint32_t targetval;
     int ret = 0;
 
-    FLOWLOCK_WRLOCK(p->flow);
+    if (flow_locked == 0)
+        FLOWLOCK_WRLOCK(p->flow);
 
     /** ATM If we are going to compare the current var with another
      * that doesn't exist, the default value will be zero;
@@ -226,7 +228,8 @@ int DetectFlowintMatch(ThreadVars *t, DetectEngineThreadCtx *det_ctx,
     }
 
 end:
-    FLOWLOCK_UNLOCK(p->flow);
+    if (flow_locked == 0)
+        FLOWLOCK_UNLOCK(p->flow);
     return ret;
 }