[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zikcq2S90S97h7Z0@nanopsycho>
Date: Wed, 24 Apr 2024 16:52:27 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Asbjørn Sloth Tønnesen <ast@...erby.net>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Ariel Elior <aelior@...vell.com>,
Manish Chopra <manishc@...vell.com>
Subject: Re: [PATCH net-next] net: qede: flower: validate control flags
Wed, Apr 24, 2024 at 03:42:48PM CEST, ast@...erby.net wrote:
>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.
Why? You can pass null.
>
>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 <ast@...erby.net>
>---
>
>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
>
>
Powered by blists - more mailing lists