Skip to contentSkip to conversation

parser_bison: make sure obj_free releases timeout policies

PATCH New Florian Westphal 1 participant 1 message Dec 12, 2023 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 parser_bison: make sure obj_free releases timeout policies

obj_free() won't release them because ->type is still 0 at this point.

Init this to CT_TIMEOUT.

---
 src/parser_bison.y                                           | 1 +
 .../shell/testcases/bogons/nft-f/ct_timeout_memleak_objfree  | 5 +++++
 2 files changed, 6 insertions(+)
 create mode 100644 tests/shell/testcases/bogons/nft-f/ct_timeout_memleak_objfree
src/parser_bison.y +1 -0
index 91c4d263dc73..ce80bcd917c3 100644
@@ -2513,6 +2513,7 @@ ct_timeout_block	:	/*empty */
 			{
 				$$ = $<obj>-1;
 				init_list_head(&$$->ct_timeout.timeout_list);
+				$$->type = NFT_OBJECT_CT_TIMEOUT;
 			}
 			|	ct_timeout_block     common_block
 			|	ct_timeout_block     stmt_separator
tests/shell/testcases/bogons/nft-f/ct_timeout_memleak_objfree new file +5 -0
new file mode 100644
index 000000000000..28b1a211de0c
@@ -0,0 +1,5 @@
+table ip filter {
+	ct timeout cttime {
+		protocol tcp
+		l3proto ip
+		policy = { close : 12s }
Signature · 1 line
2.41.0