]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
napatech: Fix potential double release of packet
authorPhil Young <py@napatech.com>
Wed, 11 Nov 2020 19:21:39 +0000 (14:21 -0500)
committerJeff Lucovsky <jeff@lucovsky.org>
Sat, 28 Nov 2020 13:09:01 +0000 (08:09 -0500)
This addresses readmine issue #4018.  There was the potential for a packet
buffer to be released twice in response to an error condition.  This
addresses this by only calling NT_NetRxRelease() when the p->ReleasePacket
is called.

(cherry picked from commit 789dcbd49d077b54726fb09738fb0f42112d00d0)

src/source-napatech.c

index 5ef6050e6d7634b484a09d4590a37f3e990d32bc..dcc0c18151ebea9237251979adcc7d02092abd82 100644 (file)
@@ -447,13 +447,10 @@ TmEcode NapatechPacketLoopZC(ThreadVars *tv, void *data, void *slot)
                       NT_NET_GET_PKT_WIRE_LENGTH(packet_buffer)))) {
 
             TmqhOutputPacketpool(ntv->tv, p);
-            NT_NetRxRelease(ntv->rx_stream, packet_buffer);
             SCReturnInt(TM_ECODE_FAILED);
         }
 
         if (unlikely(TmThreadsSlotProcessPkt(ntv->tv, ntv->slot, p) != TM_ECODE_OK)) {
-            TmqhOutputPacketpool(ntv->tv, p);
-            NT_NetRxRelease(ntv->rx_stream, packet_buffer);
             SCReturnInt(TM_ECODE_FAILED);
         }