From patchwork Fri Apr 12 18:49:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1923222 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 4VGQcD2BB0z1yYP for ; Sat, 13 Apr 2024 04:50:20 +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 1rvLyZ-0007v5-J3; Fri, 12 Apr 2024 18:50:15 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rvLyR-0007jH-5Z for kernel-team@lists.ubuntu.com; Fri, 12 Apr 2024 18:50:07 +0000 Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.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-0.canonical.com (Postfix) with ESMTPS id C7000411DF for ; Fri, 12 Apr 2024 18:50:06 +0000 (UTC) Received: by mail-il1-f198.google.com with SMTP id e9e14a558f8ab-3689678c5efso13112095ab.1 for ; Fri, 12 Apr 2024 11:50:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712947805; x=1713552605; 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=3VPLNdVTYVSeFdpyh5U9yGiZo/YAgWRNVa+IFvGGA0E=; b=dIqNe829avQQICp8bz21YRMYgwxJPGhkytTLAjvqD5Mb+NYVSQtjLQzVlEecvqAriD LLPkaKqJmSEcckKxmllLWcwoYqgbMYitMU/aydUdxl7Wur46kSoArM2TT0idvFAT9aIF fwSfBqmgGgoHeznaNazTbKwbxAtj7tQIH6vc3t+xUuZ+1YufsdLiOse8cprSyh6iotl9 dY27RL02U3Ou77dFG8l/yES8dYJR8+szt5dygHZhsWGK1/4YPtvormBuhidrLv7ulVxh UG1rG7Z0AOxE9C7eUJg6DSiiIkvEgcXAw34h0bdbK7sLQlsPB4QIyX99AphyN+lPFBFa scaQ== X-Gm-Message-State: AOJu0YyUa5+LON4mY6UbAAsnzEvd/VfJeG8w7vY00xVdMrvYU9gZub9L ge2jSkmkbiemwjfrtyEQnazarwWNYuOccPCDTrR/QTedbZcRK0bsHgozO5kees5hoxyBCRhPzha fuDW06021CTvLXaX4MFrh25UWhd48M0nbeKfzfK/1KYd+QPD64xfyJYs2SxavqdAMK+gtPInmh4 ZuXzSlkYH4pA== X-Received: by 2002:a05:6e02:154c:b0:36a:1e55:535b with SMTP id j12-20020a056e02154c00b0036a1e55535bmr3894776ilu.16.1712947805505; Fri, 12 Apr 2024 11:50:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFfNpzu11vYmXLfS0ZbTH+yQG2cDnFIZOv6WFIM4+kTVGDDUHmmkpFLk+x5K0o5oCq+BKKUqw== X-Received: by 2002:a05:6e02:154c:b0:36a:1e55:535b with SMTP id j12-20020a056e02154c00b0036a1e55535bmr3894768ilu.16.1712947805220; Fri, 12 Apr 2024 11:50:05 -0700 (PDT) Received: from smtp.gmail.com (104-218-69-129.dynamic.lnk.ne.allofiber.net. [104.218.69.129]) by smtp.gmail.com with ESMTPSA id n16-20020a056638265000b004829fa50273sm1208462jat.161.2024.04.12.11.50.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 11:50:04 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][M][PATCH 4/4] netfilter: nft_set_pipapo: release elements in clone only from destroy path Date: Fri, 12 Apr 2024 13:49:59 -0500 Message-Id: <20240412185000.22195-5-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240412185000.22195-1-bethany.jamison@canonical.com> References: <20240412185000.22195-1-bethany.jamison@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 Clone already always provides a current view of the lookup table, use it to destroy the set, otherwise it is possible to destroy elements twice. This fix requires: 212ed75dc5fb ("netfilter: nf_tables: integrate pipapo into commit protocol") which came after: 9827a0e6e23b ("netfilter: nft_set_pipapo: release elements in clone from abort path"). Fixes: 9827a0e6e23b ("netfilter: nft_set_pipapo: release elements in clone from abort path") Signed-off-by: Pablo Neira Ayuso (cherry picked from commit b0e256f3dd2ba6532f37c5c22e07cb07a36031ee) CVE-2024-26809 Signed-off-by: Bethany Jamison --- net/netfilter/nft_set_pipapo.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c index 8e9b200779666..a890aa0abad58 100644 --- a/net/netfilter/nft_set_pipapo.c +++ b/net/netfilter/nft_set_pipapo.c @@ -2238,8 +2238,6 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx, if (m) { rcu_barrier(); - nft_set_pipapo_match_destroy(ctx, set, m); - for_each_possible_cpu(cpu) pipapo_free_scratch(m, cpu); free_percpu(m->scratch); @@ -2251,8 +2249,7 @@ static void nft_pipapo_destroy(const struct nft_ctx *ctx, if (priv->clone) { m = priv->clone; - if (priv->dirty) - nft_set_pipapo_match_destroy(ctx, set, m); + nft_set_pipapo_match_destroy(ctx, set, m); for_each_possible_cpu(cpu) pipapo_free_scratch(priv->clone, cpu);