Skip to content

Commit b389139

Browse files
committed
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, d6b4786 ("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 b91d903 ("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: d6b4786 ("netfilter: nf_tables: fix underflow in object reference counter") Fixes: 628bd3e ("netfilter: nf_tables: drop map element references from preparation phase") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 3e70489 commit b389139

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6771,7 +6771,9 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
67716771
err_element_clash:
67726772
kfree(trans);
67736773
err_elem_free:
6774-
nft_set_elem_destroy(set, elem.priv, true);
6774+
nf_tables_set_elem_destroy(ctx, set, elem.priv);
6775+
if (obj)
6776+
obj->use--;
67756777
err_parse_data:
67766778
if (nla[NFTA_SET_ELEM_DATA] != NULL)
67776779
nft_data_release(&elem.data.val, desc.type);

0 commit comments

Comments
 (0)