From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jasvinder Singh Subject: [PATCH v2] net/softnic: fix memory illegal access Date: Fri, 20 Jul 2018 12:05:36 +0100 Message-ID: <20180720110536.78526-1-jasvinder.singh@intel.com> References: <20180720094439.100562-1-jasvinder.singh@intel.com> Cc: cristian.dumitrescu@intel.com To: dev@dpdk.org Return-path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 5E67B98 for ; Fri, 20 Jul 2018 13:05:39 +0200 (CEST) In-Reply-To: <20180720094439.100562-1-jasvinder.singh@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" While deleting the elements from the linked list, TAILQ_FOREACH causes read from the freed pointer. Fixes the issue by using TAILQ_FOREACH_SAFE instead. Coverity issue: 302867 Fixes: bef50bcb1c47 ("net/softnic: implement start and stop") Signed-off-by: Jasvinder Singh Acked-by: Cristian Dumitrescu --- drivers/net/softnic/rte_eth_softnic_swq.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/softnic/rte_eth_softnic_swq.c b/drivers/net/softnic/rte_eth_softnic_swq.c index 1944fbb..2083d0a 100644 --- a/drivers/net/softnic/rte_eth_softnic_swq.c +++ b/drivers/net/softnic/rte_eth_softnic_swq.c @@ -6,6 +6,7 @@ #include #include +#include #include "rte_eth_softnic_internals.h" @@ -36,9 +37,9 @@ softnic_swq_free(struct pmd_internals *p) void softnic_softnic_swq_free_keep_rxq_txq(struct pmd_internals *p) { - struct softnic_swq *swq; + struct softnic_swq *swq, *tswq; - TAILQ_FOREACH(swq, &p->swq_list, node) { + TAILQ_FOREACH_SAFE(swq, &p->swq_list, node, tswq) { if ((strncmp(swq->name, "RXQ", strlen("RXQ")) == 0) || (strncmp(swq->name, "TXQ", strlen("TXQ")) == 0)) continue; -- 2.9.3