]> git.ipfire.org Git - thirdparty/suricata.git/commit
flow/worker: handle timeout edge case
authorVictor Julien <victor@inliniac.net>
Mon, 30 Aug 2021 08:53:49 +0000 (10:53 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 1 Sep 2021 10:20:48 +0000 (12:20 +0200)
commita942b6e3cabe2a201fa337b75333f56d8d1c3d64
tree5a795b32978a7e8b95f639dc99203b32710002c1
parent0fde0002413e07175f0ac2ef194b9d270fc057e2
flow/worker: handle timeout edge case

In the flow worker timeout path it is assumed that we can hand off
flows to the recycler after processing, implying that `Flow::use_cnt` is 0.
However, there was a case where this assumption was incorrect.

When during flow timeout handling the last processed data would trigger a
protocol upgrade, two additional pseudo packets would be created that were
then pushed all the way through the engine packet paths. This would mean
they both took a flow reference and would hold that until after the flow
was handed off to the recycler. Thread safety implementation would make
sure this didn't lead to crashes.

This patch handles this case returning these packets to the pool from
the timeout handling.

(cherry picked from commit c51042e0934fd328010d41d9405fd643855aba89)
src/flow-worker.c