From 4318961230bce82958df82b57f1796143bf2f421 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 21 Sep 2021 11:39:45 +0200 Subject: nft: cache: Avoid double free of unrecognized base-chains On error, nft_cache_add_chain() frees the allocated nft_chain object along with the nftnl_chain it points at. Fix nftnl_chain_list_cb() to not free the nftnl_chain again in that case. Fixes: 176c92c26bfc9 ("nft: Introduce a dedicated base chain array") Signed-off-by: Phil Sutter --- .../tests/shell/testcases/chain/0004extra-base_0 | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 iptables/tests/shell/testcases/chain/0004extra-base_0 (limited to 'iptables/tests') diff --git a/iptables/tests/shell/testcases/chain/0004extra-base_0 b/iptables/tests/shell/testcases/chain/0004extra-base_0 new file mode 100755 index 00000000..1b85b060 --- /dev/null +++ b/iptables/tests/shell/testcases/chain/0004extra-base_0 @@ -0,0 +1,27 @@ +#!/bin/bash + +case $XT_MULTI in +*xtables-nft-multi) + ;; +*) + echo skip $XT_MULTI + exit 0 + ;; +esac + +set -e + +nft -f - <