dev.dpdk.org archive mirror
 help / color / mirror / Atom feed
From: Wang Ying A <ying.a.wang@intel.com>
To: qi.z.zhang@intel.com
Cc: qiming.yang@intel.com, dev@dpdk.org, ying.a.wang@intel.com,
	stable@dpdk.org
Subject: [dpdk-dev] [PATCH 2/3] net/ice: fix flow action validation
Date: Thu, 18 Jul 2019 09:38:42 +0800	[thread overview]
Message-ID: <1563413923-404004-3-git-send-email-ying.a.wang@intel.com> (raw)
In-Reply-To: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com>

Action is a list. We should check each element of the action
rather than the first one.
This patch fixes this issue.

Fixes: d76116a4678f ("net/ice: add generic flow API")
Cc: stable@dpdk.org

Signed-off-by: Wang Ying A <ying.a.wang@intel.com>
---
 drivers/net/ice/ice_generic_flow.c | 39 ++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c
index 464f6ec..2c57276 100644
--- a/drivers/net/ice/ice_generic_flow.c
+++ b/drivers/net/ice/ice_generic_flow.c
@@ -517,28 +517,31 @@ static int ice_flow_valid_action(struct rte_eth_dev *dev,
 {
 	const struct rte_flow_action_queue *act_q;
 	uint16_t queue;
-
-	switch (actions->type) {
-	case RTE_FLOW_ACTION_TYPE_QUEUE:
-		act_q = actions->conf;
-		queue = act_q->index;
-		if (queue >= dev->data->nb_rx_queues) {
+	const struct rte_flow_action *action;
+	for (action = actions; action->type !=
+			RTE_FLOW_ACTION_TYPE_END; action++) {
+		switch (action->type) {
+		case RTE_FLOW_ACTION_TYPE_QUEUE:
+			act_q = action->conf;
+			queue = act_q->index;
+			if (queue >= dev->data->nb_rx_queues) {
+				rte_flow_error_set(error, EINVAL,
+						RTE_FLOW_ERROR_TYPE_ACTION,
+						actions, "Invalid queue ID for"
+						" switch filter.");
+				return -rte_errno;
+			}
+			break;
+		case RTE_FLOW_ACTION_TYPE_DROP:
+		case RTE_FLOW_ACTION_TYPE_VOID:
+			break;
+		default:
 			rte_flow_error_set(error, EINVAL,
-					   RTE_FLOW_ERROR_TYPE_ACTION,
-					   actions, "Invalid queue ID for"
-					   " switch filter.");
+					   RTE_FLOW_ERROR_TYPE_ACTION, actions,
+					   "Invalid action.");
 			return -rte_errno;
 		}
-		break;
-	case RTE_FLOW_ACTION_TYPE_DROP:
-		break;
-	default:
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_ACTION, actions,
-				   "Invalid action.");
-		return -rte_errno;
 	}
-
 	return 0;
 }
 
-- 
1.8.3.1


  parent reply	other threads:[~2019-07-18  1:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-18  1:38 [dpdk-dev] [PATCH 0/3] ice: flow inputset/action validation fix and add ipv6 tc support Wang Ying A
2019-07-18  1:38 ` [dpdk-dev] [PATCH 1/3] net/ice: fix flow get inputset check Wang Ying A
2019-07-18  2:33   ` Yang, Qiming
2019-07-18  2:40     ` Wang, Ying A
2019-07-18  2:46       ` Yang, Qiming
2019-07-18  2:52         ` Wang, Ying A
2019-07-19  0:31           ` Zhang, Qi Z
2019-07-18  1:38 ` Wang Ying A [this message]
2019-07-18  2:40   ` [dpdk-dev] [PATCH 2/3] net/ice: fix flow action validation Yang, Qiming
2019-07-18  3:06   ` Yang, Qiming
2019-07-19  0:34     ` Zhang, Qi Z
2019-07-18  9:08   ` Ye Xiaolong
2019-07-18  1:38 ` [dpdk-dev] [PATCH 3/3] net/ice: add flow ipv6 tc support Wang Ying A
2019-07-18  3:06   ` Yang, Qiming
2019-07-19  0:48     ` Zhang, Qi Z

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=1563413923-404004-3-git-send-email-ying.a.wang@intel.com \
    --to=ying.a.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    /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).