From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 53639A49 for ; Mon, 16 Jul 2018 14:41:51 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Jul 2018 05:41:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,361,1526367600"; d="scan'208";a="75156029" Received: from silpixa00381635.ir.intel.com (HELO silpixa00381635.ger.corp.intel.com) ([10.237.222.149]) by orsmga002.jf.intel.com with ESMTP; 16 Jul 2018 05:41:48 -0700 From: Jasvinder Singh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com Date: Mon, 16 Jul 2018 13:41:47 +0100 Message-Id: <20180716124147.89863-1-jasvinder.singh@intel.com> X-Mailer: git-send-email 2.9.3 Subject: [dpdk-dev] [PATCH] net/softnic: fix illegal memory access 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: Mon, 16 Jul 2018 12:41:51 -0000 Fix pointer dereferencing and read after free (USE_AFTER_FREE). Coverity issue: 302867 Fixes: bef50bcb1c47 ("net/softnic: implement start and stop") Signed-off-by: Jasvinder Singh --- drivers/net/softnic/rte_eth_softnic_swq.c | 8 ++++++-- 1 file changed, 6 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..604a2cc 100644 --- a/drivers/net/softnic/rte_eth_softnic_swq.c +++ b/drivers/net/softnic/rte_eth_softnic_swq.c @@ -36,9 +36,13 @@ softnic_swq_free(struct pmd_internals *p) void softnic_softnic_swq_free_keep_rxq_txq(struct pmd_internals *p) { - struct softnic_swq *swq; + for ( ; ; ) { + struct softnic_swq *swq; + + swq = TAILQ_FIRST(&p->swq_list); + if (swq == NULL) + break; - TAILQ_FOREACH(swq, &p->swq_list, node) { if ((strncmp(swq->name, "RXQ", strlen("RXQ")) == 0) || (strncmp(swq->name, "TXQ", strlen("TXQ")) == 0)) continue; -- 2.9.3