]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: nf_tables: unbind set in rule from commit path
authorPablo Neira Ayuso <pablo@netfilter.org>
Thu, 11 May 2023 15:41:39 +0000 (17:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:11:47 +0000 (11:11 +0200)
commit8c239578182b98ea4bd3fe93a6db8d4b8a3bd60a
treebac6ed15f86b14cf0ff0cb41fd9a54f37609439b
parent6af0319cc826ed11d12678edf92da1201009c884
netfilter: nf_tables: unbind set in rule from commit path

[ backport for 4.14 of f6ac8585897684374a19863fff21186a05805286 ]

Anonymous sets that are bound to rules from the same transaction trigger
a kernel splat from the abort path due to double set list removal and
double free.

This patch updates the logic to search for the transaction that is
responsible for creating the set and disable the set list removal and
release, given the rule is now responsible for this. Lookup is reverse
since the transaction that adds the set is likely to be at the tail of
the list.

Moreover, this patch adds the unbind step to deliver the event from the
commit path.  This should not be done from the worker thread, since we
have no guarantees of in-order delivery to the listener.

This patch removes the assumption that both activate and deactivate
callbacks need to be provided.

Fixes: cd5125d8f518 ("netfilter: nf_tables: split set destruction in deactivate and destroy phase")
Reported-by: Mikhail Morfikov <mmorfikov@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c
net/netfilter/nft_dynset.c
net/netfilter/nft_immediate.c
net/netfilter/nft_lookup.c
net/netfilter/nft_objref.c