From: Greg Kroah-Hartman Date: Mon, 15 Feb 2021 12:15:23 +0000 (+0100) Subject: drop queue-4.19/netfilter-nftables-fix-possible-uaf-over-chains-from.patch X-Git-Tag: v5.4.99~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bf5290d8a8aeeaf5b9c3e6c3a64659f82cc73435;p=thirdparty%2Fkernel%2Fstable-queue.git drop queue-4.19/netfilter-nftables-fix-possible-uaf-over-chains-from.patch --- diff --git a/queue-4.19/netfilter-nftables-fix-possible-uaf-over-chains-from.patch b/queue-4.19/netfilter-nftables-fix-possible-uaf-over-chains-from.patch deleted file mode 100644 index 667794d6018..00000000000 --- a/queue-4.19/netfilter-nftables-fix-possible-uaf-over-chains-from.patch +++ /dev/null @@ -1,88 +0,0 @@ -From 142e293ce46a1c63cb167af6743e2b8abb6581df Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 2 Feb 2021 16:07:37 +0100 -Subject: netfilter: nftables: fix possible UAF over chains from packet path in - netns - -From: Pablo Neira Ayuso - -[ Upstream commit 767d1216bff82507c945e92fe719dff2083bb2f4 ] - -Although hooks are released via call_rcu(), chain and rule objects are -immediately released while packets are still walking over these bits. - -This patch adds the .pre_exit callback which is invoked before -synchronize_rcu() in the netns framework to stay safe. - -Remove a comment which is not valid anymore since the core does not use -synchronize_net() anymore since 8c873e219970 ("netfilter: core: free -hooks with call_rcu"). - -Suggested-by: Florian Westphal -Fixes: df05ef874b28 ("netfilter: nf_tables: release objects on netns destruction") -Signed-off-by: Pablo Neira Ayuso -Signed-off-by: Sasha Levin ---- - net/netfilter/nf_tables_api.c | 25 +++++++++++++++++++------ - 1 file changed, 19 insertions(+), 6 deletions(-) - -diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c -index 9cc8e92f4b000..e669e20120446 100644 ---- a/net/netfilter/nf_tables_api.c -+++ b/net/netfilter/nf_tables_api.c -@@ -7303,6 +7303,17 @@ int __nft_release_basechain(struct nft_ctx *ctx) - } - EXPORT_SYMBOL_GPL(__nft_release_basechain); - -+static void __nft_release_hooks(struct net *net) -+{ -+ struct nft_table *table; -+ struct nft_chain *chain; -+ -+ list_for_each_entry(table, &net->nft.tables, list) { -+ list_for_each_entry(chain, &table->chains, list) -+ nf_tables_unregister_hook(net, table, chain); -+ } -+} -+ - static void __nft_release_tables(struct net *net) - { - struct nft_flowtable *flowtable, *nf; -@@ -7318,10 +7329,6 @@ static void __nft_release_tables(struct net *net) - - list_for_each_entry_safe(table, nt, &net->nft.tables, list) { - ctx.family = table->family; -- -- list_for_each_entry(chain, &table->chains, list) -- nf_tables_unregister_hook(net, table, chain); -- /* No packets are walking on these chains anymore. */ - ctx.table = table; - list_for_each_entry(chain, &table->chains, list) { - ctx.chain = chain; -@@ -7368,6 +7375,11 @@ static int __net_init nf_tables_init_net(struct net *net) - return 0; - } - -+static void __net_exit nf_tables_pre_exit_net(struct net *net) -+{ -+ __nft_release_hooks(net); -+} -+ - static void __net_exit nf_tables_exit_net(struct net *net) - { - mutex_lock(&net->nft.commit_mutex); -@@ -7379,8 +7391,9 @@ static void __net_exit nf_tables_exit_net(struct net *net) - } - - static struct pernet_operations nf_tables_net_ops = { -- .init = nf_tables_init_net, -- .exit = nf_tables_exit_net, -+ .init = nf_tables_init_net, -+ .pre_exit = nf_tables_pre_exit_net, -+ .exit = nf_tables_exit_net, - }; - - static int __init nf_tables_module_init(void) --- -2.27.0 - diff --git a/queue-4.19/series b/queue-4.19/series index d6232477524..cb97236d926 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -16,7 +16,6 @@ arm-kexec-fix-oops-after-tlb-are-invalidated.patch mt76-dma-fix-a-possible-memory-leak-in-mt76_add_frag.patch bpf-check-for-integer-overflow-when-using-roundup_po.patch netfilter-xt_recent-fix-attempt-to-update-deleted-en.patch -netfilter-nftables-fix-possible-uaf-over-chains-from.patch netfilter-flowtable-fix-tcp-and-udp-header-checksum-.patch xen-netback-avoid-race-in-xenvif_rx_ring_slots_avail.patch net-stmmac-set-txq-mode-back-to-dcb-after-disabling-.patch diff --git a/queue-5.4/arm-kexec-fix-oops-after-tlb-are-invalidated.patch b/queue-5.4/arm-kexec-fix-oops-after-tlb-are-invalidated.patch index 71f151c34b3..792a98332ad 100644 --- a/queue-5.4/arm-kexec-fix-oops-after-tlb-are-invalidated.patch +++ b/queue-5.4/arm-kexec-fix-oops-after-tlb-are-invalidated.patch @@ -30,16 +30,13 @@ Tested-by: Giancarlo Ferrari Signed-off-by: Russell King Signed-off-by: Sasha Levin --- - arch/arm/include/asm/kexec-internal.h | 12 +++++++++ - arch/arm/kernel/asm-offsets.c | 5 ++++ - arch/arm/kernel/machine_kexec.c | 20 ++++++-------- - arch/arm/kernel/relocate_kernel.S | 38 ++++++++------------------- + arch/arm/include/asm/kexec-internal.h | 12 ++++++++++ + arch/arm/kernel/asm-offsets.c | 5 ++++ + arch/arm/kernel/machine_kexec.c | 20 +++++++---------- + arch/arm/kernel/relocate_kernel.S | 38 +++++++++------------------------- 4 files changed, 36 insertions(+), 39 deletions(-) create mode 100644 arch/arm/include/asm/kexec-internal.h -diff --git a/arch/arm/include/asm/kexec-internal.h b/arch/arm/include/asm/kexec-internal.h -new file mode 100644 -index 0000000000000..ecc2322db7aa1 --- /dev/null +++ b/arch/arm/include/asm/kexec-internal.h @@ -0,0 +1,12 @@ @@ -55,8 +52,6 @@ index 0000000000000..ecc2322db7aa1 +}; + +#endif -diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c -index c773b829ee8ee..bfb05c93494db 100644 --- a/arch/arm/kernel/asm-offsets.c +++ b/arch/arm/kernel/asm-offsets.c @@ -15,6 +15,7 @@ @@ -77,8 +72,6 @@ index c773b829ee8ee..bfb05c93494db 100644 + DEFINE(KEXEC_R2, offsetof(struct kexec_relocate_data, kexec_r2)); return 0; } -diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c -index 76300f3813e89..734adeb42df87 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c @@ -15,6 +15,7 @@ @@ -134,8 +127,6 @@ index 76300f3813e89..734adeb42df87 100644 /* get the identity mapping physical address for the reboot code */ reboot_entry_phys = virt_to_idmap(reboot_entry); -diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S -index 7eaa2ae7aff58..5e15b5912cb05 100644 --- a/arch/arm/kernel/relocate_kernel.S +++ b/arch/arm/kernel/relocate_kernel.S @@ -5,14 +5,16 @@ @@ -199,6 +190,3 @@ index 7eaa2ae7aff58..5e15b5912cb05 100644 relocate_new_kernel_end: .globl relocate_new_kernel_size --- -2.27.0 -