]> git.ipfire.org Git - people/ms/suricata.git/commitdiff
packetpool: ReleasePacket callback check on getter
authorVictor Julien <victor@inliniac.net>
Fri, 5 Nov 2021 19:09:17 +0000 (20:09 +0100)
committerVictor Julien <vjulien@oisf.net>
Mon, 22 Nov 2021 12:56:07 +0000 (13:56 +0100)
Any packet coming from the pool should have `PacketPoolReturnPacket`
as its callback. Check that this is the case.

src/decode.c

index d75c637522df3d4adfd271b823566b2d80d12c0b..96b21b7df2c056cbc4c23d890b46a066caf9c948 100644 (file)
@@ -67,6 +67,7 @@
 #include "output.h"
 #include "output-flow.h"
 #include "flow-storage.h"
+#include "util-validate.h"
 
 uint32_t default_packet_size = 0;
 extern bool stats_decoder_events;
@@ -194,6 +195,7 @@ Packet *PacketGetFromQueueOrAlloc(void)
         /* non fatal, we're just not processing a packet then */
         p = PacketGetFromAlloc();
     } else {
+        DEBUG_VALIDATE_BUG_ON(p->ReleasePacket != PacketPoolReturnPacket);
         PACKET_PROFILING_START(p);
     }