Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3408334rwa; Tue, 23 Aug 2022 04:24:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR4eKFtBecYAzfz8Vuf0PxMKzHeV+/4GkTNVxjPRdjsiuGWXWzuw0u26YhM+rSDy9Do90Ah1 X-Received: by 2002:a17:902:d4c7:b0:16e:df4b:89b4 with SMTP id o7-20020a170902d4c700b0016edf4b89b4mr23578668plg.142.1661253851598; Tue, 23 Aug 2022 04:24:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253851; cv=none; d=google.com; s=arc-20160816; b=iVXiksSnbHDKfENE55Yw9/b9K/BBWWKeyAsLbZXkSJ/74qsp4y4C7nd0gORuem7AQs JZzAYW5HnxVbcaeLt5zg2Ukoga0p4RkDHreYeKbtPq5nLpgKEj5w44YhROyC2lNzxQOV vEUJXb+94bB3jY5Jt3ZUGFFG0NKkQKt3z1Bk31deflV+btDar4T0JUnNF5ZsKHGixqYV Fnk/V7tNDIzIJfmuH7XIn1CNxoo5oicPvnSBFPolI8b5OURXNh9fYNRoNawYjtXvW27X zLhinCP7R3TTBVKUrDCS7kMTsBMUH8y2BDu/loJ4E3JDG6Q9jdPocC/ThxCozohespwr caPA== 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=QvPmZe6p5u9LaZxsbbxHS2XuUrxZvmyei6BibZ2tms4=; b=BrpYaRtt16Wah6v6wIUYVFa2DjHl1Y2uMMgLx7CwgqCz1yEE7A1nIxDMPDEvbeZhoW UyL1I7TG8rWmvpJR4DK91o8iVBDd5OGbvZMuRrwGprBC+ZVcVAEv1qLu3ED7qo5hMNOZ k+K1ZiFEliKVd0eSH+W0tV7wzO9ah2yD7T+kI5p+vchTVaLZxLfwUP3XT35rZXpZ21Bq vzZoCZt/qrh4ucklh/SvZHIT/gqi6doQUE2Os7U899SVhIvJyZ7kTC0ANdBiXZov86xM JVfXZkPu63D3Iey9fTh86ICJfl/WknLVOqDEV7gj5qTi9BnHs0uTqKBMwNjsQpZGBiEO w/SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aUjrgtgr; 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 u6-20020a17090341c600b00158643c240asi5584164ple.87.2022.08.23.04.24.00; Tue, 23 Aug 2022 04:24:11 -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=aUjrgtgr; 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 S1353180AbiHWKLB (ORCPT + 99 others); Tue, 23 Aug 2022 06:11:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241398AbiHWKCf (ORCPT ); Tue, 23 Aug 2022 06:02:35 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7016BA2632; Tue, 23 Aug 2022 01:51:06 -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 sin.source.kernel.org (Postfix) with ESMTPS id 379C9CE1B44; Tue, 23 Aug 2022 08:51:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D5A6C433C1; Tue, 23 Aug 2022 08:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244662; bh=7DhdAqgYCZW1Mrz80uj77CEkRyAps9tk3J+/ZPNDaSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aUjrgtgrPoYDwepJMjqQMHyfIshIERGqg3kxSKbyREy4JCP8+R4GfwDitiU2wFDK/ ApU3kbB/qjp2ekBbtxAclmYU7cLJfAhu4/Bgl25g8NCaxZOlUc9T//a9tM29cWrowr 6lWG/RYeQINUripeV0J5kBC5R++tRvNyxb6nU2kc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.15 130/244] netfilter: nf_tables: disallow NFT_SET_ELEM_CATCHALL and NFT_SET_ELEM_INTERVAL_END Date: Tue, 23 Aug 2022 10:24:49 +0200 Message-Id: <20220823080103.446569574@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080059.091088642@linuxfoundation.org> References: <20220823080059.091088642@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 commit fc0ae524b5fd2938c94d56da3f749f11eb3273d5 upstream. These flags are mutually exclusive, report EINVAL in this case. Fixes: aaa31047a6d2 ("netfilter: nftables: add catch-all set element support") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_tables_api.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -5101,6 +5101,9 @@ static int nft_setelem_parse_flags(const if (!(set->flags & NFT_SET_INTERVAL) && *flags & NFT_SET_ELEM_INTERVAL_END) return -EINVAL; + if ((*flags & (NFT_SET_ELEM_INTERVAL_END | NFT_SET_ELEM_CATCHALL)) == + (NFT_SET_ELEM_INTERVAL_END | NFT_SET_ELEM_CATCHALL)) + return -EINVAL; return 0; }