From 6c68f86b8c8fc70d5f5d0438e07821edc3e9d987 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Thu, 27 Sep 2012 14:42:49 +0530 Subject: [PATCH] fix for bug #557. 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/flow-timeout.c b/src/flow-timeout.c index 6440f752fd..fc6f41249c 100644 --- a/src/flow-timeout.c +++ b/src/flow-timeout.c @@ -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; }