[SRU Jammy, OEM-6.0, OEM-6.1, Lunar] netfilter: nf_tables: use correct lock to protect gc_list

Cengiz Can cengiz.can at canonical.com
Sat Sep 16 00:48:37 UTC 2023


From: Pablo Neira Ayuso <pablo at netfilter.org>

Use nf_tables_gc_list_lock spinlock, not nf_tables_destroy_list_lock to
protect the gc list.

Fixes: 5f68718b34a5 ("netfilter: nf_tables: GC transaction API to avoid race with control plane")
Signed-off-by: Pablo Neira Ayuso <pablo at netfilter.org>
Signed-off-by: Florian Westphal <fw at strlen.de>
(cherry picked from commit 8357bc946a2abc2a10ca40e5a2105d2b4c57515e)
CVE-2023-4244
[cengizcan: fixes the fix commit]
Signed-off-by: Cengiz Can <cengiz.can at canonical.com>
---
 net/netfilter/nf_tables_api.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index 10646308b06d..76938bd65d7d 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -9064,9 +9064,9 @@ static void nft_trans_gc_work(struct work_struct *work)
 	struct nft_trans_gc *trans, *next;
 	LIST_HEAD(trans_gc_list);
 
-	spin_lock(&nf_tables_destroy_list_lock);
+	spin_lock(&nf_tables_gc_list_lock);
 	list_splice_init(&nf_tables_gc_list, &trans_gc_list);
-	spin_unlock(&nf_tables_destroy_list_lock);
+	spin_unlock(&nf_tables_gc_list_lock);
 
 	list_for_each_entry_safe(trans, next, &trans_gc_list, list) {
 		list_del(&trans->list);
-- 
2.39.2




More information about the kernel-team mailing list