From ff55182ce3f04c8f8851dc52f1719c26e3f3a40f Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Wed, 13 May 2020 22:49:19 +0300 Subject: [PATCH] net/mlx5: fix VLAN flow action with wildcard VLAN item 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 Acked-by: Viacheslav Ovsiienko --- 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 fd002f3c57..71da5fbefe 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -1881,6 +1881,9 @@ flow_dev_get_vlan_info_from_items(const struct rte_flow_item *items, 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 */ -- 2.20.1