diff mbox series

[net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1

Message ID 20210304102943.865874-1-olteanv@gmail.com (mailing list archive)
State Accepted
Commit f1becbed411c6fa29d7ce3def3a1dcd4f63f2d74
Delegated to: Netdev Maintainers
Headers show
Series [net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1 | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Clearly marked for net
netdev/subject_prefix success Link
netdev/cc_maintainers fail 1 blamed authors not CCed: xiaoliang.yang_1@nxp.com; 1 maintainers not CCed: xiaoliang.yang_1@nxp.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link
netdev/stable success Stable not CCed

Commit Message

Vladimir Oltean March 4, 2021, 10:29 a.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

An attempt is made to warn the user about the fact that VCAP IS1 cannot
offload keys matching on destination IP (at least given the current half
key format), but sadly that warning fails miserably in practice, due to
the fact that it operates on an uninitialized "match" variable. We must
first decode the keys from the flow rule.

Fixes: 75944fda1dfe ("net: mscc: ocelot: offload ingress skbedit and vlan actions to VCAP IS1")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/ethernet/mscc/ocelot_flower.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Colin King March 4, 2021, 10:31 a.m. UTC | #1
On 04/03/2021 10:29, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> An attempt is made to warn the user about the fact that VCAP IS1 cannot
> offload keys matching on destination IP (at least given the current half
> key format), but sadly that warning fails miserably in practice, due to
> the fact that it operates on an uninitialized "match" variable. We must
> first decode the keys from the flow rule.
> 
> Fixes: 75944fda1dfe ("net: mscc: ocelot: offload ingress skbedit and vlan actions to VCAP IS1")
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> ---
>  drivers/net/ethernet/mscc/ocelot_flower.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c
> index c3ac026f6aea..a41b458b1b3e 100644
> --- a/drivers/net/ethernet/mscc/ocelot_flower.c
> +++ b/drivers/net/ethernet/mscc/ocelot_flower.c
> @@ -540,13 +540,14 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress,
>  			return -EOPNOTSUPP;
>  		}
>  
> +		flow_rule_match_ipv4_addrs(rule, &match);
> +
>  		if (filter->block_id == VCAP_IS1 && *(u32 *)&match.mask->dst) {
>  			NL_SET_ERR_MSG_MOD(extack,
>  					   "Key type S1_NORMAL cannot match on destination IP");
>  			return -EOPNOTSUPP;
>  		}
>  
> -		flow_rule_match_ipv4_addrs(rule, &match);
>  		tmp = &filter->key.ipv4.sip.value.addr[0];
>  		memcpy(tmp, &match.key->src, 4);
>  
> 

Thanks, looks good to me.

Reviewed-by: Colin Ian King <colin.king@canonical.com>
patchwork-bot+netdevbpf@kernel.org March 4, 2021, 10:20 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Thu,  4 Mar 2021 12:29:43 +0200 you wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> An attempt is made to warn the user about the fact that VCAP IS1 cannot
> offload keys matching on destination IP (at least given the current half
> key format), but sadly that warning fails miserably in practice, due to
> the fact that it operates on an uninitialized "match" variable. We must
> first decode the keys from the flow rule.
> 
> [...]

Here is the summary with links:
  - [net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1
    https://git.kernel.org/netdev/net/c/f1becbed411c

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

Patch

diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethernet/mscc/ocelot_flower.c
index c3ac026f6aea..a41b458b1b3e 100644
--- a/drivers/net/ethernet/mscc/ocelot_flower.c
+++ b/drivers/net/ethernet/mscc/ocelot_flower.c
@@ -540,13 +540,14 @@  ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress,
 			return -EOPNOTSUPP;
 		}
 
+		flow_rule_match_ipv4_addrs(rule, &match);
+
 		if (filter->block_id == VCAP_IS1 && *(u32 *)&match.mask->dst) {
 			NL_SET_ERR_MSG_MOD(extack,
 					   "Key type S1_NORMAL cannot match on destination IP");
 			return -EOPNOTSUPP;
 		}
 
-		flow_rule_match_ipv4_addrs(rule, &match);
 		tmp = &filter->key.ipv4.sip.value.addr[0];
 		memcpy(tmp, &match.key->src, 4);