2024-04-17 14:02:45

by Asbjørn Sloth Tønnesen

[permalink] [raw]
Subject: [PATCH net-next] mlxsw: spectrum_flower: validate control flags

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 <[email protected]>
---
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



2024-04-17 16:21:49

by Petr Machata

[permalink] [raw]
Subject: Re: [PATCH net-next] mlxsw: spectrum_flower: validate control flags


Asbjørn Sloth Tønnesen <[email protected]> writes:

> 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 <[email protected]>

Thanks, I'll take this through our regression.

2024-04-18 13:18:12

by Petr Machata

[permalink] [raw]
Subject: Re: [PATCH net-next] mlxsw: spectrum_flower: validate control flags


Petr Machata <[email protected]> writes:

> Asbjørn Sloth Tønnesen <[email protected]> writes:
>
>> 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 <[email protected]>
>
> Thanks, I'll take this through our regression.

Nothing bombed.

Tested-by: Petr Machata <[email protected]>

2024-04-19 00:11:05

by patchwork-bot+netdevbpf

[permalink] [raw]
Subject: Re: [PATCH net-next] mlxsw: spectrum_flower: validate control flags

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <[email protected]>:

On Wed, 17 Apr 2024 13:51:20 +0000 you wrote:
> 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.
>
> [...]

Here is the summary with links:
- [net-next] mlxsw: spectrum_flower: validate control flags
https://git.kernel.org/netdev/net-next/c/4713744d9f6e

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html