From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17171C76186 for ; Thu, 18 Jul 2019 02:40:39 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id AB0B5205F4 for ; Thu, 18 Jul 2019 02:40:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB0B5205F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7150E3257; Thu, 18 Jul 2019 04:40:33 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id BB7DE2BA8 for ; Thu, 18 Jul 2019 04:40:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2019 19:40:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,276,1559545200"; d="scan'208";a="169725203" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga007.fm.intel.com with ESMTP; 17 Jul 2019 19:40:27 -0700 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 17 Jul 2019 19:40:25 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 17 Jul 2019 19:40:25 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.134]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.109]) with mapi id 14.03.0439.000; Thu, 18 Jul 2019 10:40:23 +0800 From: "Yang, Qiming" To: "Wang, Ying A" , "Zhang, Qi Z" , "Xing, Beilei" CC: "dev@dpdk.org" Thread-Topic: [PATCH 2/3] net/ice: fix flow action validation Thread-Index: AQHVPQuoM6SR7u7nO06t8X6kqAWTSKbPqJlg Date: Thu, 18 Jul 2019 02:40:22 +0000 Message-ID: References: <1563413923-404004-1-git-send-email-ying.a.wang@intel.com> <1563413923-404004-3-git-send-email-ying.a.wang@intel.com> In-Reply-To: <1563413923-404004-3-git-send-email-ying.a.wang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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" Hi, Ying For the action check reorganization, please according to Beilei's comments,= use array to stand the action element list. And as we discussed before, it's better to change in the next release. Qiming -----Original Message----- From: Wang, Ying A=20 Sent: Thursday, July 18, 2019 9:39 AM To: Zhang, Qi Z Cc: Yang, Qiming ; dev@dpdk.org; Wang, Ying A ; stable@dpdk.org Subject: [PATCH 2/3] net/ice: fix flow action validation Action is a list. We should check each element of the action rather than th= e 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_gener= ic_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 =3D actions->conf; - queue =3D act_q->index; - if (queue >=3D dev->data->nb_rx_queues) { + const struct rte_flow_action *action; + for (action =3D actions; action->type !=3D + RTE_FLOW_ACTION_TYPE_END; action++) { + switch (action->type) { + case RTE_FLOW_ACTION_TYPE_QUEUE: + act_q =3D action->conf; + queue =3D act_q->index; + if (queue >=3D 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; } =20 -- 1.8.3.1