diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-06-26 00:42:19 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2023-06-26 17:18:55 +0200 |
commit | b389139f12f287b8ed2e2628b72df89a081f0b59 (patch) | |
tree | 855d016299a3089f728a96d6b9e088e49f99005f | |
parent | 3e70489721b6c870252c9082c496703677240f53 (diff) | |
download | linux-stable-b389139f12f287b8ed2e2628b72df89a081f0b59.tar.gz linux-stable-b389139f12f287b8ed2e2628b72df89a081f0b59.tar.bz2 linux-stable-b389139f12f287b8ed2e2628b72df89a081f0b59.zip |
netfilter: nf_tables: fix underflow in chain reference counter
Set element addition error path decrements reference counter on chains
twice: once on element release and again via nft_data_release().
Then, d6b478666ffa ("netfilter: nf_tables: fix underflow in object
reference counter") incorrectly fixed this by removing the stateful
object reference count decrement.
Restore the stateful object decrement as in b91d90368837 ("netfilter:
nf_tables: fix leaking object reference count") and let
nft_data_release() decrement the chain reference counter, so this is
done only once.
Fixes: d6b478666ffa ("netfilter: nf_tables: fix underflow in object reference counter")
Fixes: 628bd3e49cba ("netfilter: nf_tables: drop map element references from preparation phase")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | net/netfilter/nf_tables_api.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 1d64c163076a..c742918f22a4 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -6771,7 +6771,9 @@ err_set_full: err_element_clash: kfree(trans); err_elem_free: - nft_set_elem_destroy(set, elem.priv, true); + nf_tables_set_elem_destroy(ctx, set, elem.priv); + if (obj) + obj->use--; err_parse_data: if (nla[NFTA_SET_ELEM_DATA] != NULL) nft_data_release(&elem.data.val, desc.type); |