Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp641183lqb; Wed, 17 Apr 2024 07:02:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVARbl6xdnbI4rTdRqO5TrcViaKG2hvK4zmzz840qJhvKTDfNQx/YFKlCZHCSvEnf+pz/1Mmf/HOdDmsnTxVlVi8ymAWeEz2cnrTqxsmw== X-Google-Smtp-Source: AGHT+IEYXC0fdEB+1DurmZgT7z+XP5N4GBhMvr5HDM8gZds2aesmIFpkt5B1dkR5R9zs/+LzUDq0 X-Received: by 2002:a50:d755:0:b0:570:1ea8:c50a with SMTP id i21-20020a50d755000000b005701ea8c50amr8022861edj.6.1713362564094; Wed, 17 Apr 2024 07:02:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713362564; cv=pass; d=google.com; s=arc-20160816; b=Aq2tUJbNRM5eLSvo97SoN8AckShJRugsqAdGr+/cFR7J5QMFGt7/iI6IzUOSs63Nyw La5w/33wiTYcTJNHgOuSIJaE5cYB/lGjoUc663CT/Ztip1Sms/Swoo87fq5x4ieTyg6R 3dRjpFnABtgLTD5jES1pNQPydTBxqrcAQfDaIeD4B5SqDFiR5F/GlTMZGfPR3E576vEg 6NzNtS8yy0brJmUTv7b3Bu0+oHwl++j6TFpM8pR5dORiC1dKQip6qwj/PbhVfer1ODCM F8Zqs+HKtuMqQ+uiOB8yFJXSIu8OGfHRjLv6v8Xslnvvx2ilF2lBAaSRPY/z0wElVfE5 xsWw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=AiUwZIx/nP0S/uEKsQrrIKL5ZeTV9c0vAl0E6oEn0f8=; fh=BCpICmYTGgqRgHqzmaotNvY02OoRCQgYaHflGEAa02o=; b=bmOJplKTyOXsfEy5uQEGk46f0fl+FgnJ6WG2PO9b/4ipRRLmqtqIWY4+E58mGaiaKu csqZpXcN8SwwnCfJOHXErZ+Ghb+1ekvQ6MpVZdRh3m6WtXW8y9Nd40SeVRdNJ6KDU+0g Nkw3UEDdQCm1fPxJNjT0Y+uWZFlG1qtDnZYfVdEZgwehRE4YU5bs0GZRv5NjK3i2+hnm Gd3La5Z5krUdOebU5bnPKoMSmfddmrRdYR+rXBZVtaM1Gm0BM0RTdb1w84ookkzasjbw dtpewdFSykluy3W0S+rlZTUKPpqSEYKLA6ZnrMTh7Vrxr2P6MAXsst9hSvvD92bc5MUW 1aEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=pjcIVCXN; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-148632-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148632-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id z13-20020a056402274d00b0056e2e45325bsi6801039edd.539.2024.04.17.07.02.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 07:02:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148632-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=pjcIVCXN; arc=pass (i=1 spf=pass spfdomain=fiberby.net dkim=pass dkdomain=fiberby.net dmarc=pass fromdomain=fiberby.net); spf=pass (google.com: domain of linux-kernel+bounces-148632-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148632-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8A8391F25078 for ; Wed, 17 Apr 2024 13:52:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E6E4C140E3D; Wed, 17 Apr 2024 13:52:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="pjcIVCXN" Received: from mail1.fiberby.net (mail1.fiberby.net [193.104.135.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F02DA13C81F; Wed, 17 Apr 2024 13:52:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.104.135.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713361965; cv=none; b=mgH5L1j905MoQhAOhpKSQfsb1cNrhShHnlIvZmPm6GnW92UkpoPne7QQkGGckSM2gLvGcmjfTRAfPqEpstUcd3MCCJqPKxlRf5B9PdCFsmEPdrSLI7insOWs3NMUVfOvQa9bbCHIuik24bSre9JLg4qLdAu9STkMY5ZTve66/ec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713361965; c=relaxed/simple; bh=4Cmcmmzl6A6wun1x2yb3/vcGq9AxnztLrcfzCmZZJlE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=YFnI0eDi47e6i0IY/69pC58qP59CXn+KDtU/AcszVW5IuSMyGcPYQHoYEW+ecWpm5rDn/xmb3cge7balocECj9EXW9D6igAI3LbzwULMiSHv6UVbfKq5sA8z66PlPIvCBVgfqTfWAAr8DTMkXkXmyie85fVVyjuSl9FYA1FaQpc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net; spf=pass smtp.mailfrom=fiberby.net; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b=pjcIVCXN; arc=none smtp.client-ip=193.104.135.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=fiberby.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fiberby.net Received: from x201s (193-104-135-243.ip4.fiberby.net [193.104.135.243]) by mail1.fiberby.net (Postfix) with ESMTPSA id 8CFC7600A2; Wed, 17 Apr 2024 13:52:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713361953; bh=4Cmcmmzl6A6wun1x2yb3/vcGq9AxnztLrcfzCmZZJlE=; h=From:To:Cc:Subject:Date:From; b=pjcIVCXNTxr1YmJPkL1TWaxn+SQm6stYgn86q/JpDYAOuib5zFrOAuxGrkhxZJ9/o DxS0eRBIftNC5aQ3YBBxxm7/Cd4CcFermzSZrvSi3HaM7Dh4LNtD0rt/a56p99W7MQ TXavCXLc0gO4aaODYZDNY59b3czL+PzunXCT9MIr0h75bT9TzXDVA5sBkhOD7lYVy1 qceVXmTIPWpwY1yeB4kp1yYXS9T5Hi3uX9PRvKZ7OgofZO74fc3EI71Y/BcL3tGOyG tgK8Y3DYlTuHjqVdO8KpyoFwslsewZ+YQXZJ7FVObTUoskGRcwtk+9rOGIkxeBGlEH Q56XSLIdzzyUQ== Received: by x201s (Postfix, from userid 1000) id 07E5520445E; Wed, 17 Apr 2024 13:52:24 +0000 (UTC) From: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= To: netdev@vger.kernel.org Cc: =?UTF-8?q?Asbj=C3=B8rn=20Sloth=20T=C3=B8nnesen?= , linux-kernel@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Ido Schimmel , Petr Machata Subject: [PATCH net-next] mlxsw: spectrum_flower: validate control flags Date: Wed, 17 Apr 2024 13:51:20 +0000 Message-ID: <20240417135131.99921-1-ast@fiberby.net> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This driver currently doesn't support any control flags. Use flow_rule_has_control_flags() to check for control flags, such as can be set through `tc flower ... ip_flags frag`. In case any control flags are masked, flow_rule_has_control_flags() sets a NL extended error message, and we return -EOPNOTSUPP. Only compile-tested. Signed-off-by: Asbjørn Sloth Tønnesen --- drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c index 9fd1ca079258..f07955b5439f 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c @@ -595,6 +595,10 @@ static int mlxsw_sp_flower_parse(struct mlxsw_sp *mlxsw_sp, flow_rule_match_control(rule, &match); addr_type = match.key->addr_type; + + if (flow_rule_has_control_flags(match.mask->flags, + f->common.extack)) + return -EOPNOTSUPP; } if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) { -- 2.43.0