Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3104721rwe; Mon, 29 Aug 2022 06:02:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR551IhGm8PcnHiluDugVLHS8tl/LJSVFCkn6boHGpQd2mpXyq9k0n8090uWBe3We/zR9Rds X-Received: by 2002:a17:906:8a74:b0:73d:d6bd:660b with SMTP id hy20-20020a1709068a7400b0073dd6bd660bmr12853337ejc.200.1661778153610; Mon, 29 Aug 2022 06:02:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661778153; cv=none; d=google.com; s=arc-20160816; b=q6jmbkd2Y/KwvXuWHu1epRwGd7y32bxYeoBTezURoD+zc1XJB3NzJY134wOl+KoGgH 7kGP8E3QK9m+RSJQj1Y/A8QuXqEpSwb9TNu+qpJm0TYBvatGeADdpwJmTqBpT9yHfEBI HHoDmWpgi7LDmIZEY102FigJeg20QlC9x27UGE7rNwixCwf6eDdIt/LfpDvArBtNMeTU ga/ehwDrXTr4NiEwK/A2C/R6tfcZ9uplEYvCd7b6L5u1bErUQ9KOWau60W+ViKaJws7J PiFobpnxwO9s7c2iTiJGG8D6S9FEOUZlt72zwPEqVrOxCzWz5DpEK25xkHArsfmTP8qY uOqQ== 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=x7fvT2qzImhQI7z+4SgIDCxHEwMhFIJZbRyu6+dcKjQ=; b=LQ3SLnSFj0h9D4APW0HCGDFjN6437NfBVh6LL8JGTgte/+cST+MmKubKW3CDk9OrfB bqtJ0sthcUSDaynKJ6CLGYJ4xw2X5iaukf+dxkjMezWRcvp1wSjFWzTRgGqqDqZ1oo0v HOFE4+6PaDYN4jkxdaydS1IYcvspGs3tyQNFhHrWDLuGUgkWQncLUi8xEzAS8byCiV/E FIu59ZJqcJS7u0c8Rfhdu7daTiub6GJBTQk6qCgh2aYkFf2qO6q9DuAOJdtTJS5z0hl0 Z61+HpCTcOtQ8w4M49A2g9nHccYID55aiMkbcj91AA8OY7fF6vgENLtZPnzgXlZbVlKy 3Ypw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pmtCWVOv; 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 hg3-20020a1709072cc300b00741ad7e8c35si293772ejc.624.2022.08.29.06.02.05; Mon, 29 Aug 2022 06:02:33 -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=pmtCWVOv; 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 S230270AbiH2Mb7 (ORCPT + 99 others); Mon, 29 Aug 2022 08:31:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbiH2Mba (ORCPT ); Mon, 29 Aug 2022 08:31:30 -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 065A2844FA; Mon, 29 Aug 2022 05:15:33 -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 62C26B80F96; Mon, 29 Aug 2022 11:14:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8964C433D6; Mon, 29 Aug 2022 11:14:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771677; bh=VaHDkz+mEMtnoNiMQi0bFo7NhEGDBbcyFRo6oNeVm3Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pmtCWVOvwqXzoUbixsHDrmXdOkuwvj0yjUp+yezWEEuyTKTCYZdnVxhV2MwJvzaVd RSzqFemK2Bx0R2ngcG3luKo2BNP++nZ34BMLgrIivNbfnbbFdy1T8HeSeOKzYHZVPi wsff8KAu9MEAw80vWmQ9xDI61KfxWZ+xN/d0oDOQ= 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 060/158] netfilter: nft_osf: restrict osf to ipv4, ipv6 and inet families Date: Mon, 29 Aug 2022 12:58:30 +0200 Message-Id: <20220829105811.228713661@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 5f3b7aae14a706d0d7da9f9e39def52ff5fc3d39 ] As it was originally intended, restrict extension to supported families. Fixes: b96af92d6eaf ("netfilter: nf_tables: implement Passive OS fingerprint module in nft_osf") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin --- net/netfilter/nft_osf.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c index 5eed18f90b020..175d666c8d87e 100644 --- a/net/netfilter/nft_osf.c +++ b/net/netfilter/nft_osf.c @@ -115,9 +115,21 @@ static int nft_osf_validate(const struct nft_ctx *ctx, const struct nft_expr *expr, const struct nft_data **data) { - return nft_chain_validate_hooks(ctx->chain, (1 << NF_INET_LOCAL_IN) | - (1 << NF_INET_PRE_ROUTING) | - (1 << NF_INET_FORWARD)); + unsigned int hooks; + + switch (ctx->family) { + case NFPROTO_IPV4: + case NFPROTO_IPV6: + case NFPROTO_INET: + hooks = (1 << NF_INET_LOCAL_IN) | + (1 << NF_INET_PRE_ROUTING) | + (1 << NF_INET_FORWARD); + break; + default: + return -EOPNOTSUPP; + } + + return nft_chain_validate_hooks(ctx->chain, hooks); } static bool nft_osf_reduce(struct nft_regs_track *track, -- 2.35.1