From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0853A43206; Thu, 26 Oct 2023 11:33:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BDCE2402CE; Thu, 26 Oct 2023 11:33:33 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id 0F93B402C5 for ; Thu, 26 Oct 2023 11:33:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698312812; x=1729848812; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=+sEXOOCRj5bx8VKa/6jbi6GSVOFZ5VUEYEnpi6xdJH0=; b=Z2jFxT0m5EGmzDKf5foNw2U3m5joWY+MYHX5iKWBoHrdUzArQNey3CsW /1Zg430/WIkl2j/b6vQG1kJdsllDYaZLZcQa7Pm+m+LfkyyZCuhAbBDIx bDlwzj+v5EKhZuXLX8lkRKqBERSGXtsW+XzLc5ceZPFX2/MtbVXMvjzt4 7mlg/LX1z80VUyRlSuO1R848Z4y1u/2ByebMDmez08f2b78C7FGgOwVtt FcxJ6kBElOKtR1FV2Lx2n6yE1xEuCgD5RFHV9op3KMyC1rYH5P0/JoSSA tBX6vhHicQN9kcxFWizxoukldKkJ3FX6qtq7lJXFDraYRA+/fOAYE29sL g==; X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="384707219" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="384707219" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 02:33:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10874"; a="735686606" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="735686606" Received: from shwdenpg561.ccr.corp.intel.com (HELO dpdk..) ([10.239.252.3]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 02:33:27 -0700 From: Kaiwen Deng To: dev@dpdk.org Cc: qiming.yang@intel.com, yidingx.zhou@intel.com, Kaiwen Deng , Jingjing Wu , Beilei Xing , Wenzhuo Lu , Bruce Richardson Subject: [PATCH] net/iavf: fix core dump when exiting testpmd Date: Thu, 26 Oct 2023 16:54:44 +0800 Message-Id: <20231026085444.497296-1-kaiwenx.deng@intel.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org release null mbuf results coredump. This commit adding mbuf check before releasing. Fixes: 12016895fcf3 ("net/iavf: fix buffer leak on Tx queue stop") Signed-off-by: Kaiwen Deng --- drivers/net/iavf/iavf_rxtx_vec_common.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_rxtx_vec_common.h b/drivers/net/iavf/iavf_rxtx_vec_common.h index e18cdc3f11..f50a500536 100644 --- a/drivers/net/iavf/iavf_rxtx_vec_common.h +++ b/drivers/net/iavf/iavf_rxtx_vec_common.h @@ -187,8 +187,11 @@ _iavf_tx_queue_release_mbufs_vec(struct iavf_tx_queue *txq) i = txq->next_dd - txq->rs_thresh + 1; while (i != txq->tx_tail) { - rte_pktmbuf_free_seg(txq->sw_ring[i].mbuf); - txq->sw_ring[i].mbuf = NULL; + if (txq->sw_ring[i].mbuf) { + rte_pktmbuf_free_seg(txq->sw_ring[i].mbuf); + txq->sw_ring[i].mbuf = NULL; + } + if (++i == txq->nb_tx_desc) i = 0; } -- 2.34.1