netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1
@ 2021-03-04 10:29 Vladimir Oltean
  2021-03-04 10:31 ` Colin Ian King
  2021-03-04 22:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Oltean @ 2021-03-04 10:29 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Claudiu Manoil,
	Alexandre Belloni, UNGLinuxDriver, Vladimir Oltean,
	Colin Ian King

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);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1
  2021-03-04 10:29 [PATCH net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1 Vladimir Oltean
@ 2021-03-04 10:31 ` Colin Ian King
  2021-03-04 22:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Colin Ian King @ 2021-03-04 10:31 UTC (permalink / raw)
  To: Vladimir Oltean, David S . Miller, Jakub Kicinski, netdev
  Cc: Andrew Lunn, Florian Fainelli, Vivien Didelot, Claudiu Manoil,
	Alexandre Belloni, UNGLinuxDriver, Vladimir Oltean

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>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1
  2021-03-04 10:29 [PATCH net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1 Vladimir Oltean
  2021-03-04 10:31 ` Colin Ian King
@ 2021-03-04 22:20 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-03-04 22:20 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: davem, kuba, netdev, andrew, f.fainelli, vivien.didelot,
	claudiu.manoil, alexandre.belloni, UNGLinuxDriver,
	vladimir.oltean, colin.king

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-04 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-04 10:29 [PATCH net] net: mscc: ocelot: properly reject destination IP keys in VCAP IS1 Vladimir Oltean
2021-03-04 10:31 ` Colin Ian King
2021-03-04 22:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).