From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0A1DD374F for ; Wed, 19 Jul 2017 05:43:34 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2017 20:43:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,379,1496127600"; d="scan'208";a="994555881" Received: from dpdk1.bj.intel.com ([172.16.182.84]) by orsmga003.jf.intel.com with ESMTP; 18 Jul 2017 20:43:32 -0700 From: Wei Zhao To: dev@dpdk.org Cc: Wei Zhao Date: Wed, 19 Jul 2017 11:34:33 +0800 Message-Id: <1500435273-18176-1-git-send-email-wei.zhao1@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1500272004-35941-1-git-send-email-wei.zhao1@intel.com> References: <1500272004-35941-1-git-send-email-wei.zhao1@intel.com> Subject: [dpdk-dev] [PATCH v2] net/ixgbe: add queue index check in filter 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: , X-List-Received-Date: Wed, 19 Jul 2017 03:43:35 -0000 Add queue index check when create filter rule, or filter with invalid queue id can be created successfully. Signed-off-by: Wei Zhao --- v2: -fix build error. --- drivers/net/ixgbe/ixgbe_flow.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c index f70bdb0..8da8708 100644 --- a/drivers/net/ixgbe/ixgbe_flow.c +++ b/drivers/net/ixgbe/ixgbe_flow.c @@ -487,9 +487,7 @@ ixgbe_parse_ntuple_filter(struct rte_eth_dev *dev, return -rte_errno; } - if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM || - filter->priority > IXGBE_5TUPLE_MAX_PRI || - filter->priority < IXGBE_5TUPLE_MIN_PRI) + if (filter->queue >= dev->data->nb_rx_queues) return -rte_errno; /* fixed value for ixgbe */ @@ -706,7 +704,7 @@ ixgbe_parse_ethertype_filter(struct rte_eth_dev *dev, return -rte_errno; } - if (filter->queue >= IXGBE_MAX_RX_QUEUE_NUM) { + if (filter->queue >= dev->data->nb_rx_queues) { memset(filter, 0, sizeof(struct rte_eth_ethertype_filter)); rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, @@ -983,6 +981,9 @@ ixgbe_parse_syn_filter(struct rte_eth_dev *dev, ret = cons_parse_syn_filter(attr, pattern, actions, filter, error); + if (filter->queue >= dev->data->nb_rx_queues) + return -rte_errno; + if (ret) return ret; @@ -1176,6 +1177,9 @@ ixgbe_parse_l2_tn_filter(struct rte_eth_dev *dev, return -rte_errno; } + if (l2_tn_filter->pool >= dev->data->nb_rx_queues) + return -rte_errno; + return ret; } @@ -2541,6 +2545,10 @@ ixgbe_parse_fdir_filter(struct rte_eth_dev *dev, if (fdir_mode == RTE_FDIR_MODE_NONE || fdir_mode != rule->mode) return -ENOTSUP; + + if (rule->queue >= dev->data->nb_rx_queues) + return -ENOTSUP; + return ret; } -- 2.9.3