From patchwork Fri Jul 19 05:28:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 56752 X-Patchwork-Delegate: qi.z.zhang@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id CD773231E; Fri, 19 Jul 2019 07:43:39 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id B66771DBF for ; Fri, 19 Jul 2019 07:43:37 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2019 22:43:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,280,1559545200"; d="scan'208";a="170810249" Received: from beileix_srv.sh.intel.com (HELO beilei_21.sh.intel.com) ([10.67.111.125]) by orsmga003.jf.intel.com with ESMTP; 18 Jul 2019 22:43:36 -0700 From: Beilei Xing To: qi.z.zhang@intel.com Cc: dev@dpdk.org Date: Fri, 19 Jul 2019 13:28:28 +0800 Message-Id: <20190719052828.29870-1-beilei.xing@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] net/ice: fix unsafe tailq element removal 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" TAILQ_FOREACH macro is not safe to remove elements during iterating tailq lists. Replace it with TAILQ_FOREACH_SAFE. Fixes: d76116a4678f ("net/ice: add generic flow API") Signed-off-by: Beilei Xing Acked-by: Qi Zhang --- drivers/net/ice/ice_generic_flow.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ice/ice_generic_flow.c b/drivers/net/ice/ice_generic_flow.c index c2931a1c4..05c84afaf 100644 --- a/drivers/net/ice/ice_generic_flow.c +++ b/drivers/net/ice/ice_generic_flow.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "ice_ethdev.h" #include "ice_generic_flow.h" @@ -655,9 +656,10 @@ ice_flow_flush(struct rte_eth_dev *dev, { struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private); struct rte_flow *p_flow; + void *temp; int ret = 0; - TAILQ_FOREACH(p_flow, &pf->flow_list, node) { + TAILQ_FOREACH_SAFE(p_flow, &pf->flow_list, node, temp) { ret = ice_flow_destroy(dev, p_flow, error); if (ret) { rte_flow_error_set(error, -ret,