net/mlx5: fix VLAN actions with wildcard VLAN iten

Message ID d837fe2744af60e76ded9b2d45b8cede234a862f.1589399264.git.dekelp@mellanox.com (mailing list archive)
State Accepted, archived
Delegated to: Raslan Darawsheh
Headers
Series net/mlx5: fix VLAN actions with wildcard VLAN iten |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing fail Testing issues

Commit Message

Dekel Peled May 13, 2020, 7:49 p.m. UTC
  Previous patch added support of VLAN item without VLAN ID value,
i.e. using wildcard VLAN item, to match VLAN with any VLAN ID.
The implication on VLAN actions was not taken into consideration.
VLAN actions (e.g. push vlan) use the VLAN ID value in the VLAN item,
and expect it to be valid.

This patch updates function flow_dev_get_vlan_info_from_items() to
check the VLAN item contents before trying to use it.

Fixes: 92818d839e8e ("net/mlx5: fix match on empty VLAN item in DV mode")
Cc: stable@dpdk.org

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Raslan Darawsheh May 14, 2020, 8:59 a.m. UTC | #1
Hi,

> -----Original Message-----
> From: Dekel Peled <dekelp@mellanox.com>
> Sent: Wednesday, May 13, 2020 10:49 PM
> To: Matan Azrad <matan@mellanox.com>; Slava Ovsiienko
> <viacheslavo@mellanox.com>; Raslan Darawsheh <rasland@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [PATCH] net/mlx5: fix VLAN actions with wildcard VLAN iten
> 
> Previous patch added support of VLAN item without VLAN ID value,
> i.e. using wildcard VLAN item, to match VLAN with any VLAN ID.
> The implication on VLAN actions was not taken into consideration.
> VLAN actions (e.g. push vlan) use the VLAN ID value in the VLAN item,
> and expect it to be valid.
> 
> This patch updates function flow_dev_get_vlan_info_from_items() to
> check the VLAN item contents before trying to use it.
> 
> Fixes: 92818d839e8e ("net/mlx5: fix match on empty VLAN item in DV
> mode")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow_dv.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow_dv.c
> b/drivers/net/mlx5/mlx5_flow_dv.c
> index 8b018fb..ed2ecd2 100644
> --- a/drivers/net/mlx5/mlx5_flow_dv.c
> +++ b/drivers/net/mlx5/mlx5_flow_dv.c
> @@ -1881,6 +1881,9 @@ struct field_modify_info modify_tcp[] = {
>  		const struct rte_flow_item_vlan *vlan_m = items->mask;
>  		const struct rte_flow_item_vlan *vlan_v = items->spec;
> 
> +		/* If VLAN item in pattern doesn't contain data, return here.
> */
> +		if (!vlan_v)
> +			return;
>  		if (!vlan_m)
>  			vlan_m = &nic_mask;
>  		/* Only full match values are accepted */
> --
> 1.8.3.1


Fixed typo in commit title (iten->item)

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh
  

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 8b018fb..ed2ecd2 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1881,6 +1881,9 @@  struct field_modify_info modify_tcp[] = {
 		const struct rte_flow_item_vlan *vlan_m = items->mask;
 		const struct rte_flow_item_vlan *vlan_v = items->spec;
 
+		/* If VLAN item in pattern doesn't contain data, return here. */
+		if (!vlan_v)
+			return;
 		if (!vlan_m)
 			vlan_m = &nic_mask;
 		/* Only full match values are accepted */