Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3077585rwe; Mon, 29 Aug 2022 05:34:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR61j893H7pS7YvQJID/eTj/w2YmOLG/OVqQfZrLov6ntcWEcMPdM9GLTTTNPYroCACmPINo X-Received: by 2002:a63:8643:0:b0:42b:66ab:b051 with SMTP id x64-20020a638643000000b0042b66abb051mr14138742pgd.259.1661776468267; Mon, 29 Aug 2022 05:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661776468; cv=none; d=google.com; s=arc-20160816; b=nZSDReGVHfpLDffmQOkuF8bboIMq8ZeOjZGSrFMzJkQm9rY5Ko1EtlHx0W8RFx+hel T3RXHbq8kHO5vJjhOGMEmNUX2n6iVCELDIts1RX2jseN6ElA9+GAvmrvA+CpqWU8lMu3 FKiEJWx/ZbJXOngLudUYYjoPJIleeqlOWQR0G0NutBNHlX0l4qAlnaXgWqTTNN5mEISI n9qZHn2qevNoEm3/bjSynjp++7VNdexzjZPJDuDGQ8IBgCtWXzATrpnLqJkQVrIzNuWN PSpud7G9tOHnxhQlTwXSVciP7grN4Sh5WB8mgTjW1oUxxCPhwrL26Ic/ApGpqX0hJRAq lVuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZhhO5PL1UAgQfUU8HEz4YptKboYRFIRLjNYhzvW2G6A=; b=D7+EPE4w61q8O5osKkpj8E3TA0ceafeoR87G/EQcgHNE8CtyBZ5j1fFoILaPejhzyk f0TLXrlIns2l33ISQKesI1GV8GQusoG2Dj9TwqzDTTKFjnwQCdyABMHXJFPVvwNnxHPV cF3JJFS3nuN6Y0FNN6qOyXHp5x0J+86OCIlK79eFMa8PQxGU/tbDRfYBv71i5Umj9hXJ cDiIbH26tvExgJMiCn8eXsb2ZgLgnEeDeOGj1N5Ruv+JJVUC+xCAFnfQH5xFc8PW79id 8A9cQrjmdz6vPWPzjBRBVpzg5lazcTL5mLhlZZeV+8spGaawW7sxNmJlGSvfkKRAKmK5 mfzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ClkpduBs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 5-20020a630005000000b0041cea5fee28si9157207pga.748.2022.08.29.05.34.16; Mon, 29 Aug 2022 05:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ClkpduBs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231164AbiH2La7 (ORCPT + 99 others); Mon, 29 Aug 2022 07:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232492AbiH2L3J (ORCPT ); Mon, 29 Aug 2022 07:29:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDC8379EE5; Mon, 29 Aug 2022 04:17:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4DE72611F3; Mon, 29 Aug 2022 11:07:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60EA2C433C1; Mon, 29 Aug 2022 11:07:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771246; bh=nBwKVtuE3HX+ZqecDlfmmiUBj5o2lt46TJHtL3RZv7o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ClkpduBsz32ynnRsIn/V03xoTWKCCGbVS4JiiZvJIBmy91pqEH8SZF9PmihfkS3ve pg5nacr1IUsKeg+jotnCBp0B0cubZ7uHC0pMfcI9+HQkRVKlPZh61ekjT5w8PrcwgL 9kYSd8n7gnDzJecJz7Nf/iF+9Ft+EViaKeFmBBxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gwangun Jung , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.10 43/86] netfilter: nf_tables: disallow binding to already bound chain Date: Mon, 29 Aug 2022 12:59:09 +0200 Message-Id: <20220829105758.306654273@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105756.500128871@linuxfoundation.org> References: <20220829105756.500128871@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pablo Neira Ayuso [ Upstream commit e02f0d3970404bfea385b6edb86f2d936db0ea2b ] Update nft_data_init() to report EINVAL if chain is already bound. Fixes: d0e2c7de92c7 ("netfilter: nf_tables: add NFT_CHAIN_BINDING") Reported-by: Gwangun Jung Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- 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 b36728cfc5d81..1b039476e4d6a 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -8678,6 +8678,8 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data, return PTR_ERR(chain); if (nft_is_base_chain(chain)) return -EOPNOTSUPP; + if (nft_chain_is_bound(chain)) + return -EINVAL; if (desc->flags & NFT_DATA_DESC_SETELEM && chain->flags & NFT_CHAIN_BINDING) return -EINVAL; -- 2.35.1