From patchwork Thu Aug 3 15:15:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thadeu Lima de Souza Cascardo X-Patchwork-Id: 1816517 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=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=kx02bkcD; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (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 4RGsrh01Dmz1yYC for ; Fri, 4 Aug 2023 01:16:52 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qRa4E-0006xS-Of; Thu, 03 Aug 2023 15:16:46 +0000 Received: from smtp-relay-canonical-0.internal ([10.131.114.83] helo=smtp-relay-canonical-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qRa4D-0006wz-La for kernel-team@lists.ubuntu.com; Thu, 03 Aug 2023 15:16:45 +0000 Received: from localhost.localdomain (1.general.cascardo.us.vpn [10.172.70.58]) (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-canonical-0.canonical.com (Postfix) with ESMTPSA id AD7A53F161 for ; Thu, 3 Aug 2023 15:16:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1691075805; bh=wo0BFx7lv8OcyxxUhsdSCXk5806vRuswORkprg/B4ws=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kx02bkcDcJLs3QkxJ5zzKo1/X6+PJmkWwTJWmXJnfnc9dP4DzLDn5eMn6XCFPEQH9 1gy0+aIPKNh6XdviBFmVMJbtRT0KaIKpTbrN/RlV5yH9cG6ll2uWroTf9NcsXLLPCJ vtOVz9cDOTHhuNFb0jy9NHXIYemmrWeTK9KcpOwKx4Dm6X1uQtHWVNYraMXrgO2ePg Iic/7Wk3TP0AezrfkFHaVoCiJEcMRkjw0KCziNqFBOtuRhP9uSA5HXaFony2FVPylC Ct0dk559VvGeHXU2LY3g5WGF37fZmAEkKL1o3M3nTG0PbJx88cAP9m3TMxpUe8DZpN HWfuOyyZ39T3Q== From: Thadeu Lima de Souza Cascardo To: kernel-team@lists.ubuntu.com Subject: [Jammy, OEM-5.17, OEM-6.0, OEM-6.1, Lunar 1/2] netfilter: nf_tables: skip bound chain on rule flush Date: Thu, 3 Aug 2023 12:15:23 -0300 Message-Id: <20230803151524.659940-2-cascardo@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230803151524.659940-1-cascardo@canonical.com> References: <20230803151524.659940-1-cascardo@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 Skip bound chain when flushing table rules, the rule that owns this chain releases these objects. Otherwise, the following warning is triggered: WARNING: CPU: 2 PID: 1217 at net/netfilter/nf_tables_api.c:2013 nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] CPU: 2 PID: 1217 Comm: chain-flush Not tainted 6.1.39 #1 RIP: 0010:nf_tables_chain_destroy+0x1f7/0x210 [nf_tables] Fixes: d0e2c7de92c7 ("netfilter: nf_tables: add NFT_CHAIN_BINDING") Reported-by: Kevin Rich Signed-off-by: Pablo Neira Ayuso Signed-off-by: Florian Westphal (cherry picked from commit 6eaf41e87a223ae6f8e7a28d6e78384ad7e407f8) CVE-2023-3777 Signed-off-by: Thadeu Lima de Souza Cascardo --- net/netfilter/nf_tables_api.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 74d2e910590c..c22b077d882f 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3816,6 +3816,8 @@ static int nf_tables_delrule(struct sk_buff *skb, const struct nfnl_info *info, list_for_each_entry(chain, &table->chains, list) { if (!nft_is_active_next(net, chain)) continue; + if (nft_chain_is_bound(chain)) + continue; ctx.chain = chain; err = nft_delrule_by_chain(&ctx);