Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp425865lqd; Wed, 24 Apr 2024 06:43:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW3YimICld5MMo3QYA0/WYHeDE881MevjZnB7KPyR4ga4EKUxiMikTd98/cDyMhuyOyjTdCjlQL3CVNjcqiKuH8ZC5ydw7/qY9cFpwRJw== X-Google-Smtp-Source: AGHT+IHa2xu6rBrsdV4c3420AgUhBJxbGeQwn3vTGrRxhS46Ybya74Te7WYqVOpuEex+U2gfCba5 X-Received: by 2002:a25:a1a7:0:b0:de5:53a6:24ed with SMTP id a36-20020a25a1a7000000b00de553a624edmr2541454ybi.50.1713966219674; Wed, 24 Apr 2024 06:43:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713966219; cv=pass; d=google.com; s=arc-20160816; b=TUX0DUsbX7fRrfHdm1uJOelQVDjUq0gsqzO4nTKEU9zsxVYhj54eBqJsAgDaIiYCZj J5sX8rGLwlRNwXiT05U3Zu4ohRaji1SdIXOHCv1QXx8YdTZVDolH9kp3XpmchagwYF/K 29s8z0t+SpCHbgSDWrhl/fqzHxbOn8HcNSVSR9rY7yX69594wWJbfuLSZtsqC13rOqcr HuAzGJs5NoYAjP2vN3PVfPIkMxyYdYxeV3nK7i5dmiKU2lxuxDzblCVJI4Q7aEVyh7VM qCKWbk+DZVFM5VI6T46nXGnCv5VOIbxIGMZrI/qhM7HsQllHL2SliF+5lQiazVpz9KDB IEkg== 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=2+umh4oKLg3qHsn2uBwcjqlVLg/lElqnL45+C8GjvSg=; fh=dpgh49eyuNCj2njCtRoyEFN8fqIMJq69hE86mmdQOhQ=; b=zmgR6fuwmcpyBiXxpLCV4QlG8+Ns+ELGu5KWaeQwQc75MFWoOnRSS/g67A660x3JFL nLBRhUcltkCAjobJux6K7xhSvHyJURiHz8buA53VM7MEeKUDudGJRtvhT/v/U+xr93hz ADXI7epmCEnlzXlsubwHU53MEAKURJrVRFtkmXs68Iy/LS3tK4/n/qvWDbHtW96Iju2J vAnVFvlKdLu3cBQs2EXMB7iZf32+e0999mV/OZzwvk6xp7wqAO3KJ7K/ACW4DSipWu8E QJFKX1SIqUgeBMF/x4UdeZnVMUBaiYmR29H0sBr4Z/O71fZOpcm3Jt8Aj3HAecr8zk5M cwlg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=X1O+trFs; 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-156996-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156996-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=fiberby.net Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 15-20020a05621420cf00b006a08e47bdcfsi3358035qve.241.2024.04.24.06.43.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 06:43:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156996-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@fiberby.net header.s=202008 header.b=X1O+trFs; 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-156996-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156996-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 670C01C22285 for ; Wed, 24 Apr 2024 13:43:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05A8015D5D8; Wed, 24 Apr 2024 13:43:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fiberby.net header.i=@fiberby.net header.b="X1O+trFs" 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 CF53A15B986; Wed, 24 Apr 2024 13:43:07 +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=1713966191; cv=none; b=bFNmZE+wIeSV2K28GadXTkZtzKeriEz4O5lnKuBoB/9BzOq5jcXN9TRb4h12KxHbRBFMvGuNyZEJvT9XJ+//osEPUwfi0XCxn27DiNEF5+Cc3ioZipijM+ZBR3a5KpsPbsLNN70T8PzXcrqzGdXtT+5wMVdjzWxD9pSfd+IH0F8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713966191; c=relaxed/simple; bh=EWAIznzUX0DHOlahRpLSJ/x5hLx2THJ0Nhx/H7hZWYw=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=o3uKQdhDSEC51X9IW4heoiXLc/Y75S1du3CKWcNBrr8rXq5zF0oYgjngBvYQv1qOdUBzwYaDfFAC2eryRzzwBpWAkv6RtCw4nxXd7dZxnF0a4HyEfWil6NLQfLNA7DqbkkcmdmU6GzBLzU5sIb5X6KR1kre+kz/mfLGRFjg1rhY= 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=X1O+trFs; 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 E9574600A7; Wed, 24 Apr 2024 13:42:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fiberby.net; s=202008; t=1713966185; bh=EWAIznzUX0DHOlahRpLSJ/x5hLx2THJ0Nhx/H7hZWYw=; h=From:To:Cc:Subject:Date:From; b=X1O+trFsOgKa62JcfLSbuM0jHkDfDyHFfKNmEg+YxkjXEz3RJC9jULsnBaTlg11MX GOxef++oKDXDEJeHDHckE235YLIYyAF+CfgiYfauHu6M+LjZ+oLGoFv6p/2OT69ksn 4fdYVhForzGduvlLAi4fvxvzXwDWdfJxQLQYozEHoeoYB+JfKIMsDBnt2sP2GVlIXh YyKflYYtgDtBrAhBQg9FC081zDTnH0wBKQHVpR1moDOf1hvfOXh7djXpiOpn/1NfuZ vzTTYn1uVT6dRBSJpam84mELLNd4/YVmaq+DAL98TpLwixT8gG71z8mKzWzwnv/Qqh ZrI0/mSonGWYg== Received: by x201s (Postfix, from userid 1000) id 967542044F0; Wed, 24 Apr 2024 13:42:52 +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 , Ariel Elior , Manish Chopra Subject: [PATCH net-next] net: qede: flower: validate control flags Date: Wed, 24 Apr 2024 13:42:48 +0000 Message-ID: <20240424134250.465904-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 flower control flags. Implement check for control flags, such as can be set through `tc flower ... ip_flags frag`. Since qede_parse_flow_attr() are called by both qede_add_tc_flower_fltr() and qede_flow_spec_to_rule(), as the latter doesn't having access to extack, then flow_rule_*_control_flags() can't be used in this driver. This patch therefore re-implements flow_rule_match_has_control_flags(), but with error messaging via DP_NOTICE, instead of NL_SET_ERR_MSG_FMT_MOD. So in case any control flags are masked, we call DP_NOTICE() and return -EOPNOTSUPP. Only compile-tested. Signed-off-by: Asbjørn Sloth Tønnesen --- This is AFAICT the last driver which didn't validate these flags. $ git grep FLOW_DISSECTOR_KEY_CONTROL drivers/ $ git grep 'flow_rule_.*_control_flags' drivers/ drivers/net/ethernet/qlogic/qede/qede_filter.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c index a5ac21a0ee33..40f72e700d8e 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_filter.c +++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c @@ -1843,6 +1843,19 @@ qede_parse_flow_attr(struct qede_dev *edev, __be16 proto, return -EPROTONOSUPPORT; } + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) { + struct flow_match_control match; + + flow_rule_match_control(rule, &match); + + if (match.mask->flags) { + DP_NOTICE(edev, + "Unsupported match on control.flags %#x", + match.mask->flags); + return -EOPNOTSUPP; + } + } + if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) { struct flow_match_basic match; -- 2.43.0