From 55873ac03bbdf0e27174c33d24735e846753663a Mon Sep 17 00:00:00 2001 From: Beilei Xing Date: Tue, 18 Apr 2017 16:46:20 +0800 Subject: [PATCH] net/i40e: add check for invalid VF queue number Add check to avoid invalid VF queue number is used in tunnel filter. Signed-off-by: Beilei Xing Acked-by: Bernard Iremonger --- drivers/net/i40e/i40e_flow.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c index 8fe626c888..0a0181fe27 100644 --- a/drivers/net/i40e/i40e_flow.c +++ b/drivers/net/i40e/i40e_flow.c @@ -1234,13 +1234,19 @@ i40e_flow_parse_tunnel_action(struct rte_eth_dev *dev, if (act->type == RTE_FLOW_ACTION_TYPE_QUEUE) { act_q = (const struct rte_flow_action_queue *)act->conf; filter->queue_id = act_q->index; - if (!filter->is_to_vf) - if (filter->queue_id >= pf->dev_data->nb_rx_queues) { - rte_flow_error_set(error, EINVAL, + if ((!filter->is_to_vf) && + (filter->queue_id >= pf->dev_data->nb_rx_queues)) { + rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act, "Invalid queue ID for tunnel filter"); - return -rte_errno; - } + return -rte_errno; + } else if (filter->is_to_vf && + (filter->queue_id >= pf->vf_nb_qps)) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, + act, "Invalid queue ID for tunnel filter"); + return -rte_errno; + } } /* Check if the next non-void item is END */ -- 2.20.1