]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
fix for bug #557.
authorAnoop Saldanha <anoopsaldanha@gmail.com>
Thu, 27 Sep 2012 09:12:49 +0000 (14:42 +0530)
committerVictor Julien <victor@inliniac.net>
Tue, 2 Oct 2012 08:20:09 +0000 (10:20 +0200)
In FFRv2, dereference flow from a packet using the new reference/dereference
util macros.  This allows the decr use_cnt for flow and reseting the flow
pointer to NULL for the pseudo pkt to happen simultaneously, in case there we
fail to retrieve a pseudo_packet and have to return the already obtained
pseudo packets, back to the packetpool.

src/flow-timeout.c

index 6440f752fde7cc69d62dc4e7bb938dc4b3289130..fc6f41249cbe25bdbcc9f7ef52f5473184f4ea7a 100644 (file)
@@ -369,19 +369,23 @@ int FlowForceReassemblyForFlowV2(Flow *f, int server, int client)
         if (server == 1) {
             p2 = FlowForceReassemblyPseudoPacketGet(0, f, ssn, 0);
             if (p2 == NULL) {
-                TmqhOutputPacketpool(NULL,p1);
+                FlowDeReference(&p1->flow);
+                TmqhOutputPacketpool(NULL, p1);
                 return 1;
             }
 
             p3 = FlowForceReassemblyPseudoPacketGet(1, f, ssn, 1);
             if (p3 == NULL) {
+                FlowDeReference(&p1->flow);
                 TmqhOutputPacketpool(NULL, p1);
+                FlowDeReference(&p2->flow);
                 TmqhOutputPacketpool(NULL, p2);
                 return 1;
             }
         } else {
             p2 = FlowForceReassemblyPseudoPacketGet(0, f, ssn, 1);
             if (p2 == NULL) {
+                FlowDeReference(&p1->flow);
                 TmqhOutputPacketpool(NULL, p1);
                 return 1;
             }
@@ -396,6 +400,7 @@ int FlowForceReassemblyForFlowV2(Flow *f, int server, int client)
 
             p2 = FlowForceReassemblyPseudoPacketGet(1, f, ssn, 1);
             if (p2 == NULL) {
+                FlowDeReference(&p1->flow);
                 TmqhOutputPacketpool(NULL, p1);
                 return 1;
             }
@@ -408,6 +413,7 @@ int FlowForceReassemblyForFlowV2(Flow *f, int server, int client)
             if (server == 2) {
                 p2 = FlowForceReassemblyPseudoPacketGet(1, f, ssn, 1);
                 if (p2 == NULL) {
+                    FlowDeReference(&p1->flow);
                     TmqhOutputPacketpool(NULL, p1);
                     return 1;
                 }
@@ -423,6 +429,7 @@ int FlowForceReassemblyForFlowV2(Flow *f, int server, int client)
 
             p2 = FlowForceReassemblyPseudoPacketGet(1, f, ssn, 1);
             if (p2 == NULL) {
+                FlowDeReference(&p1->flow);
                 TmqhOutputPacketpool(NULL, p1);
                 return 1;
             }