Blame SOURCES/0023-nft-cache-Reset-genid-when-rebuilding-cache.patch

fc8f74
From 3b98024d952d265d50078c5b7ad04c9c65373733 Mon Sep 17 00:00:00 2001
fc8f74
From: Phil Sutter <psutter@redhat.com>
fc8f74
Date: Fri, 29 May 2020 19:33:22 +0200
fc8f74
Subject: [PATCH] nft: cache: Reset genid when rebuilding cache
fc8f74
fc8f74
This is required in order to avoid a cache rebuild loop if
fc8f74
iptables-nft-restore is called with '--test' parameter and a dump
fc8f74
containing more than a single table.
fc8f74
fc8f74
If non-zero, __nft_build_cache() never updates genid and therefore the
fc8f74
incorrect genid (caused by increment in nft_action()) is never
fc8f74
corrected.
fc8f74
fc8f74
This is a RHEL-only fix, upstream rewrote the whole cache logic which
fc8f74
implicitly resolved this problem.
fc8f74
fc8f74
Fixes: 200bc39965149 ("nft: cache: Fix iptables-save segfault under stress")
fc8f74
Signed-off-by: Phil Sutter <psutter@redhat.com>
fc8f74
---
fc8f74
 iptables/nft-cache.c | 1 +
fc8f74
 1 file changed, 1 insertion(+)
fc8f74
fc8f74
diff --git a/iptables/nft-cache.c b/iptables/nft-cache.c
fc8f74
index 07265b7795e4f..bc6e7f7eaebfb 100644
fc8f74
--- a/iptables/nft-cache.c
fc8f74
+++ b/iptables/nft-cache.c
fc8f74
@@ -629,6 +629,7 @@ void nft_rebuild_cache(struct nft_handle *h)
fc8f74
 	if (h->cache_level)
fc8f74
 		__nft_flush_cache(h);
fc8f74
 
fc8f74
+	h->nft_genid = 0;
fc8f74
 	h->cache_level = NFT_CL_NONE;
fc8f74
 	__nft_build_cache(h, level, NULL, NULL, NULL);
fc8f74
 }
fc8f74
-- 
fc8f74
2.26.2
fc8f74