DPDK patches and discussions
 help / color / mirror / Atom feed
From: Beilei Xing <beilei.xing@intel.com>
To: jingjing.wu@intel.com
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] net/i40e: add check for invalid VF queue number
Date: Tue, 18 Apr 2017 16:46:20 +0800	[thread overview]
Message-ID: <1492505180-50780-1-git-send-email-beilei.xing@intel.com> (raw)

Add check to avoid invalid VF queue number is used in
tunnel filter.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
---
 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 8fe626c..0a0181f 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.5.5

             reply	other threads:[~2017-04-18  8:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18  8:46 Beilei Xing [this message]
2017-04-18 13:29 ` Iremonger, Bernard
2017-04-19 10:46   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492505180-50780-1-git-send-email-beilei.xing@intel.com \
    --to=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).