From e522731823bbe0ab5e27f79844efa7c967f546bc Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 15 2020 17:41:02 +0000 Subject: Apply patch 0016-nft-cache-Fix-nft_release_cache-under-stress.patch patch_name: 0016-nft-cache-Fix-nft_release_cache-under-stress.patch present_in_specfile: true location_in_specfile: 16 --- diff --git a/iptables/nft-cache.c b/iptables/nft-cache.c index 7345a27..6f21f22 100644 --- a/iptables/nft-cache.c +++ b/iptables/nft-cache.c @@ -647,8 +647,14 @@ void nft_rebuild_cache(struct nft_handle *h) void nft_release_cache(struct nft_handle *h) { - if (h->cache_index) - flush_cache(h, &h->__cache[0], NULL); + if (!h->cache_index) + return; + + flush_cache(h, &h->__cache[0], NULL); + memcpy(&h->__cache[0], &h->__cache[1], sizeof(h->__cache[0])); + memset(&h->__cache[1], 0, sizeof(h->__cache[1])); + h->cache_index = 0; + h->cache = &h->__cache[0]; } struct nftnl_table_list *nftnl_table_list_get(struct nft_handle *h)