summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatan Azrad <matan@mellanox.com>2017-07-27 13:27:24 +0300
committerYuanhan Liu <yliu@fridaylinux.org>2017-08-29 14:55:38 +0800
commitea0c41bce01aeafd24b490f50c142d0a7fd35dfa (patch)
tree62f280912005aa3c2af11ab90b187f31db944307
parent40dc666e665cf70869e2b6847db63285eca35508 (diff)
downloaddpdk-stable-ea0c41bce01aeafd24b490f50c142d0a7fd35dfa.zip
dpdk-stable-ea0c41bce01aeafd24b490f50c142d0a7fd35dfa.tar.gz
dpdk-stable-ea0c41bce01aeafd24b490f50c142d0a7fd35dfa.tar.xz
net/mlx4: fix flow creation before start
[ upstream commit f3b10f1d2474dfa6774ec31e1a8dc14c76b3ac53 ] The corrupted code causes segmentation fault when user creates flow with drop action before device starting. For example, failsafe PMD recreates all the flows before calling dev_start in plug-in sequence and mlx4 allocated its flow drop queue in dev_start. Hence, when failsafe created flow with drop action after plug-in event, mlx4 tried to dereference flow drop queue which was uninitialized. The fix added check to the drop qp accessible and conditioned the ibv_create_flow calling on device starting. Fixes: 642fe56a1ba5 ("net/mlx4: use a single drop queue for all drop flows") Fixes: 46d5736a7049 ("net/mlx4: support basic flow items and actions") Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
-rw-r--r--drivers/net/mlx4/mlx4_flow.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/mlx4/mlx4_flow.c b/drivers/net/mlx4/mlx4_flow.c
index edfac03..b9a024b 100644
--- a/drivers/net/mlx4/mlx4_flow.c
+++ b/drivers/net/mlx4/mlx4_flow.c
@@ -829,7 +829,7 @@ priv_flow_create_action_queue(struct priv *priv,
return NULL;
}
if (action->drop) {
- qp = priv->flow_drop_queue->qp;
+ qp = priv->flow_drop_queue ? priv->flow_drop_queue->qp : NULL;
} else {
struct rxq *rxq = (*priv->rxqs)[action->queue_id];
@@ -837,6 +837,8 @@ priv_flow_create_action_queue(struct priv *priv,
rte_flow->qp = qp;
}
rte_flow->ibv_attr = ibv_attr;
+ if (!priv->started)
+ return rte_flow;
rte_flow->ibv_flow = ibv_create_flow(qp, rte_flow->ibv_attr);
if (!rte_flow->ibv_flow) {
rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE,