From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 78F10A0471 for ; Thu, 18 Jul 2019 04:26:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8176A2C17; Thu, 18 Jul 2019 04:26:58 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 1936628EE; Thu, 18 Jul 2019 04:26:56 +0200 (CEST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 19:26:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,276,1559545200"; d="scan'208";a="168134667" Received: from yexl-server.sh.intel.com (HELO localhost) ([10.67.110.185]) by fmsmga008.fm.intel.com with ESMTP; 17 Jul 2019 19:26:54 -0700 Date: Thu, 18 Jul 2019 17:08:29 +0800 From: Ye Xiaolong To: Wang Ying A Cc: qi.z.zhang@intel.com, qiming.yang@intel.com, dev@dpdk.org, stable@dpdk.org Message-ID: <20190718090829.GA88943@intel.com> References: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com> <1563413923-404004-3-git-send-email-ying.a.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1563413923-404004-3-git-send-email-ying.a.wang@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH 2/3] net/ice: fix flow action validation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 07/18, Wang Ying A wrote: >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 >--- > 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 > Reviewed-by: Xiaolong Ye