Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3085541rwe; Mon, 29 Aug 2022 05:42:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR6vyjS4eyDJ3da8B/4iZaHZFae4ySNFE4PXbu5MarqeFp9GFRefCdkq+orwoHl34etPwf3p X-Received: by 2002:a63:8b4c:0:b0:42c:65f5:29c3 with SMTP id j73-20020a638b4c000000b0042c65f529c3mr988787pge.397.1661776946980; Mon, 29 Aug 2022 05:42:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661776946; cv=none; d=google.com; s=arc-20160816; b=FZF+97Ax+9nXLzrCwkqh5ZdOMY75Kh0okWHwwJL4f2yWMWGPRTm9l09SS0JpALkOS9 njNetaeABBbu+6NucJkUAWXr+d2x/O4xyoSOL3KUp8Ttx+Gmj/yK/UKG1YCNNq5Jk3/F iHlDl0Fpqcds4yJoW80VIitJX6mg7PP5BWrj3l8iOwxIPi31ZsjciLbQhk/DVq3eLvdw PfTDKaa+VLR4b+v6F4sX9kPL1201VuTSvyMJkilSZaoz0XRri/WpBNTxLQdyoukxioz6 UmvOQ1g1QQgoLlRlzxbQyh55LMMdPF6kaDJdWYdZIImIIj13DwAbKnH6WHchWBepn4FW qcNw== 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=ZBrKk0rmnHzseeTPtSdOhfjKTI3GoMGg7GT2nZnkWho=; b=Nea0ELYbZ+b4WtgZp+MhyQm73svKdO2j04p7cluQ00xFn7gZBlZ1nu8NLkM+nT/8Uq +Ww3VDS4bylf3B6RjVQlmtyTgW80qN6UA5Kr58w77XbB/sXdh8rwcE8GhVdApLsFmdKD +TNO72u6Mo2TI6T4nCPU1u+vHA+VqE0AiRhOttZ1Kr47H6BOgD+0vyk/0qk6nvMqGyn0 hfl0NP40QPEwC4pH7NXl4VBd5v4+YAQlfjdZTo7qiOk9u0eIjHmIpDZOrkdBAeO7xNBl P8Qz7QgLsKLUSKieeBrOW6h6POPQFG0qkr43/Y1NQmS8I1PfGXv4rF88eOGPEY7l+fvx H7OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="rQu4X/mo"; 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 d14-20020a621d0e000000b00534eb9da2e7si8691317pfd.304.2022.08.29.05.42.14; Mon, 29 Aug 2022 05:42:26 -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="rQu4X/mo"; 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 S232069AbiH2L0J (ORCPT + 99 others); Mon, 29 Aug 2022 07:26:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232125AbiH2LYV (ORCPT ); Mon, 29 Aug 2022 07:24:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 554C6E7F; Mon, 29 Aug 2022 04:15:22 -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 0664C61228; Mon, 29 Aug 2022 11:14:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1018BC433D6; Mon, 29 Aug 2022 11:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771645; bh=NJ1j8HAFO0vnyzXmqvs6B3GuyCXln2ABXhvO7ExB9pQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rQu4X/moALBvrKeD5wlkOcT1ziEjCb0TcfAfoC1HmYNwZz3acywL2OarTbkmfrcir hZaeISoVZFk1fPDKzCVn3YvYr0/qmsHQbA+5nxXuxZLoMMTuClEcwZtwHfdatQTMBD 0r3AxtM+lLRMZIfEsXyGMEX9YW2xGUN0gJeehbGU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.19 055/158] netfilter: nf_tables: disallow updates of implicit chain Date: Mon, 29 Aug 2022 12:58:25 +0200 Message-Id: <20220829105811.033862583@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@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 5dc52d83baac30decf5f3b371d5eb41dfa1d1412 ] Updates on existing implicit chain make no sense, disallow this. Fixes: d0e2c7de92c7 ("netfilter: nf_tables: add NFT_CHAIN_BINDING") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nf_tables_api.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 4bd6e9427c918..8b6ee9df817fb 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2574,6 +2574,9 @@ static int nf_tables_newchain(struct sk_buff *skb, const struct nfnl_info *info, nft_ctx_init(&ctx, net, skb, info->nlh, family, table, chain, nla); if (chain != NULL) { + if (chain->flags & NFT_CHAIN_BINDING) + return -EINVAL; + if (info->nlh->nlmsg_flags & NLM_F_EXCL) { NL_SET_BAD_ATTR(extack, attr); return -EEXIST; -- 2.35.1