Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3408968rwa; Tue, 23 Aug 2022 04:24:49 -0700 (PDT) X-Google-Smtp-Source: AA6agR4dkQpN8QcG5XejGGsqqLx/AKauch/kgfX/cCsBcoeY6rPP/Qq6XJvpiH1qi8ciEoiFpu6p X-Received: by 2002:a63:91c8:0:b0:41d:33d1:209e with SMTP id l191-20020a6391c8000000b0041d33d1209emr20083753pge.407.1661253889709; Tue, 23 Aug 2022 04:24:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253889; cv=none; d=google.com; s=arc-20160816; b=Wm7AYG7EXMDXrkAfQ9Nho49TSCxDdPtXb0Ugzlv89Ly/xIgCV4R6zsOk4S+VTq4jwl BO6aN/P6njqv7fXBwG5NULhsVVBhNRsrbnqcF7JSsMfJyTd8tk579bDYmVpshJg2/uJi F4wzrhESKIwsw1Fpq4JLOduc7MZ8uk9yq4H31oWv603i+f8RXjOlmzAIiGlrtck6lv4M 1k14K/6viQaqCq3rOhn4Usc8UueybbX2IArkTjrXVCBoB/C7LddodnOghMN2oZjhmW0Q hdfAsXLbxclJIBD71N7ZuvvzpE4XIhJSccOU6M/Bc7KiFF7smudbWVsGUzbOk2JFH8S/ tGVw== 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=VF5rkaGR0FiLbxAaT9FhROwz0NEEv7POY5hY4nBrAzA=; b=T8yk25ijwG8Cd2GsAq0PrTckJg1SlNyq4y0hfnQLS58IrX37miMyaTfMy2/OdSkMid aytZlH6TdP4/+baomUHDdyPQJrdSGf6mwrJuUSr4yicWitRvehwursxuUahlDcdyxNxx Zim4jQaUwz0DiwA5XckNdW0Tq0/jznL0zY0lnutn9X0HreaoMdNmoRIzrVJ4KVK8IahN 3XTWr2HrPEhjIP2s0bs2Sz/+AQALwvWC/O54Wf8BNKVz+/xdTI3aIvd2CDU9wy6Vq5/G tMcM0no8jaWl4zVxwH3MNEinmiP5JReoQNicU1NgvGqtizeustR0xMYWM8Q8KV5PL0b0 a29Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZCj642yJ; 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 h123-20020a636c81000000b0041c86b0597dsi15307869pgc.594.2022.08.23.04.24.39; Tue, 23 Aug 2022 04:24:49 -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=ZCj642yJ; 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 S241137AbiHWJGH (ORCPT + 99 others); Tue, 23 Aug 2022 05:06:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243417AbiHWJFI (ORCPT ); Tue, 23 Aug 2022 05:05:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3554074B8F; Tue, 23 Aug 2022 01:29:13 -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 ams.source.kernel.org (Postfix) with ESMTPS id 07BF8B81C48; Tue, 23 Aug 2022 08:28:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68CDDC433D6; Tue, 23 Aug 2022 08:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243285; bh=0kRc/kQ7IVCbJ2ZgeyLpv5oI5kf4VZzx/zouu/0Opm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZCj642yJQMEfTDgTiQ+I0WG8rZPEPs/K7Q+6TqGZr0ILYZscnzFbn/I9aY7Q7Nlef JGy92gTASqFk5E1d57VwEWL5qJHXoQlbAXtiH2gEGbULI2dxTWOLoWX3DLxP6dmHbo PeKE8EFphC3Ourzc4TW2CJx5hV5t20k+WHKRn4T0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pablo Neira Ayuso Subject: [PATCH 5.19 201/365] netfilter: nf_tables: disallow NFT_SET_ELEM_CATCHALL and NFT_SET_ELEM_INTERVAL_END Date: Tue, 23 Aug 2022 10:01:42 +0200 Message-Id: <20220823080126.628524897@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@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 @@ -5198,6 +5198,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; }