From patchwork Sat Sep 16 00:48:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cengiz Can X-Patchwork-Id: 1835334 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RnXdf1sd9z1yhP for ; Sat, 16 Sep 2023 10:54:46 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qhJZv-0002n7-Er; Sat, 16 Sep 2023 00:54:31 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qhJXJ-0008Qk-I9 for kernel-team@lists.ubuntu.com; Sat, 16 Sep 2023 00:51:50 +0000 Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 9A7113F63C for ; Sat, 16 Sep 2023 00:51:48 +0000 (UTC) Received: by mail-pg1-f198.google.com with SMTP id 41be03b00d2f7-57828ffbbe6so864487a12.0 for ; Fri, 15 Sep 2023 17:51:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694825507; x=1695430307; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YDSJ0QSnPOPx7zD9BvnqEWLPIp15w2Z9LIpM6iGjoRU=; b=W9sLV3cmaoXmM3qvTwr/76rUZDBTap+oHNXWZbFOzfz695Hi7J4Q8Nmbs1xxVWi1lW ySfmS17DaFeBp4taC3YYV67Q8rVmJQTphAgW3saGY2dfapfuefY5oP6iZ/U90uKDQQPr aCiB6JxKF4KqfNnU01C458rM8cOzRCzER1eWgRmiWHHHfJRz3AHISHPKCZayS9mveCTX fZuS8uQqW/KWR160TWBALyGoEUIlR3PE/g9b9WwsoX/B5QAczaIUVAGt3Sw0N4fymN5J OrmFtyzKaExjokz6bNY1eAx2H96MPMZ3AQd7tWxSFHytWZQ71E6dfreUGQBab++1Gmnw hYQw== X-Gm-Message-State: AOJu0YzgFysNXW82Ox7pCLafwKbn8QhP1qJsqNb2O5AmIZMNn6GPrFs3 AjZz8/uR/B9lB6GffAc3dx5VUPabsRQLuXtLVxmLkJrNMZAMlV9t2+tuUuoOu/lVelCp9eCY36O 8I968FZH+32xz4K8rcxuuLcyeum7B/EAQENxeb1lrxoWBpP2mG0PF X-Received: by 2002:a05:6a20:2583:b0:153:8db6:c4fe with SMTP id k3-20020a056a20258300b001538db6c4femr3735143pzd.39.1694825506975; Fri, 15 Sep 2023 17:51:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2TybdKM1+32yk/yGEYCiCeCSxEKyJy4vPR5cMMJVV7UdZfoMQs4y6qtRFpys3Ka/tch3URA== X-Received: by 2002:a05:6a20:2583:b0:153:8db6:c4fe with SMTP id k3-20020a056a20258300b001538db6c4femr3735136pzd.39.1694825506705; Fri, 15 Sep 2023 17:51:46 -0700 (PDT) Received: from localhost (uk.sesame.canonical.com. [185.125.190.60]) by smtp.gmail.com with ESMTPSA id q5-20020a170902dac500b001b8b2b95068sm4052097plx.204.2023.09.15.17.51.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 17:51:46 -0700 (PDT) From: Cengiz Can To: kernel-team@lists.ubuntu.com Subject: [SRU Jammy, OEM-6.0, OEM-6.1, Lunar] netfilter: nf_tables: use correct lock to protect gc_list Date: Sat, 16 Sep 2023 03:48:37 +0300 Message-Id: <20230916004839.706452-28-cengiz.can@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230916004839.706452-1-cengiz.can@canonical.com> References: <20230916004839.706452-1-cengiz.can@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Pablo Neira Ayuso 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 Signed-off-by: Florian Westphal (cherry picked from commit 8357bc946a2abc2a10ca40e5a2105d2b4c57515e) CVE-2023-4244 [cengizcan: fixes the fix commit] Signed-off-by: Cengiz Can --- 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);