diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-05-19 18:58:40 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2019-05-20 20:56:47 +0200 |
commit | f6ad231d698c7c091371264d8d1881cbb9cf0ba1 (patch) | |
tree | 9d3d5edbf6e58189566aab376f7ad9112cf6e167 /iptables/nft.h | |
parent | ab1cd3b510fa5d5642b8698c5bd5c125b53ff7c7 (diff) |
nft: keep original cache in case of ERESTART
Phil Sutter says:
"The problem is that data in h->obj_list potentially sits in cache, too.
At least rules have to be there so insert with index works correctly. If
the cache is flushed before regenerating the batch, use-after-free
occurs which crashes the program."
This patch keeps around the original cache until we have refreshed the
batch.
Fixes: 862818ac3a0de ("xtables: add and use nft_build_cache")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'iptables/nft.h')
-rw-r--r-- | iptables/nft.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/iptables/nft.h b/iptables/nft.h index dc0797d3..43eb8a39 100644 --- a/iptables/nft.h +++ b/iptables/nft.h @@ -48,7 +48,8 @@ struct nft_handle { struct list_head err_list; struct nft_family_ops *ops; const struct builtin_table *tables; - struct nft_cache __cache; + unsigned int cache_index; + struct nft_cache __cache[2]; struct nft_cache *cache; bool have_cache; bool restore; |