diff mbox series

[SRU,Lunar,1/2] netfilter: nf_tables: skip bound chain in netns release path

Message ID 20230927131944.161522-3-cascardo@canonical.com
State New
Headers show
Series [SRU,Lunar,1/2] netfilter: nf_tables: skip bound chain in netns release path | expand

Commit Message

Thadeu Lima de Souza Cascardo Sept. 27, 2023, 1:19 p.m. UTC
From: Pablo Neira Ayuso <pablo@netfilter.org>

Skip bound chain from netns release path, the rule that owns this chain
releases these objects.

Fixes: d0e2c7de92c7 ("netfilter: nf_tables: add NFT_CHAIN_BINDING")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
(cherry picked from commit 751d460ccff3137212f47d876221534bf0490996)
CVE-2023-5197
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
---
 net/netfilter/nf_tables_api.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index fc5b4f86b0cc..aeca514d54df 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -10470,6 +10470,9 @@  static void __nft_release_table(struct net *net, struct nft_table *table)
 	ctx.family = table->family;
 	ctx.table = table;
 	list_for_each_entry(chain, &table->chains, list) {
+		if (nft_chain_is_bound(chain))
+			continue;
+
 		ctx.chain = chain;
 		list_for_each_entry_safe(rule, nr, &chain->rules, list) {
 			list_del(&rule->list);