summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiaoyu Min <jackmin@mellanox.com>2019-08-20 17:47:14 +0800
committerKevin Traynor <ktraynor@redhat.com>2019-09-13 10:37:20 +0100
commitb42591099b8377b36125ad2486516b8507a748d0 (patch)
tree214232fe0253a6a77c288e93dbbefa2ab82992f4
parent43db8daaed7a7543355980da152b60e3d8e77eb5 (diff)
downloaddpdk-stable-b42591099b8377b36125ad2486516b8507a748d0.zip
dpdk-stable-b42591099b8377b36125ad2486516b8507a748d0.tar.gz
dpdk-stable-b42591099b8377b36125ad2486516b8507a748d0.tar.xz
net/mlx5: fix crash for empty raw encap data
[ upstream commit c6cc228e9ddf3df925ac9482925059666bc9acb1 ] For the rte_flow_action_raw_encap, the header definition for encapsulation must be available, otherwise it will lead to crash on some OFED versions and logically it should be rejected. Fixes: 8ba9eee4ce32 ("net/mlx5: add raw data encap/decap to Direct Verbs") Cc: stable@dpdk.org Signed-off-by: Xiaoyu Min <jackmin@mellanox.com> Acked-by: Dekel Peled <dekelp@mellanox.com>
-rw-r--r--drivers/net/mlx5/mlx5_flow_dv.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 3b514d6..3c61083 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -196,6 +196,8 @@ flow_dv_validate_action_raw_encap(uint64_t action_flags,
const struct rte_flow_attr *attr,
struct rte_flow_error *error)
{
+ const struct rte_flow_action_raw_encap *raw_encap =
+ (const struct rte_flow_action_raw_encap *)action->conf;
if (!(action->conf))
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, action,
@@ -216,6 +218,10 @@ flow_dv_validate_action_raw_encap(uint64_t action_flags,
NULL,
"encap action not supported for "
"ingress");
+ if (!raw_encap->size || !raw_encap->data)
+ return rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_ACTION, action,
+ "raw encap data cannot be empty");
return 0;
}